Java Code Examples for com.rabbitmq.client.BasicProperties#getCorrelationId()

The following examples show how to use com.rabbitmq.client.BasicProperties#getCorrelationId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RabbitMQConsumerActor.java    From ditto with Eclipse Public License 2.0 6 votes vote down vote up
private static Map<String, String> extractHeadersFromMessage(final BasicProperties properties,
        final Envelope envelope) {

    final Map<String, String> headersFromProperties = getHeadersFromProperties(properties.getHeaders());

    // set headers specific to rmq messages
    if (properties.getReplyTo() != null) {
        headersFromProperties.put(ExternalMessage.REPLY_TO_HEADER, properties.getReplyTo());
    }
    if (properties.getCorrelationId() != null) {
        headersFromProperties.put(DittoHeaderDefinition.CORRELATION_ID.getKey(), properties.getCorrelationId());
    }
    if (properties.getContentType() != null) {
        headersFromProperties.put(ExternalMessage.CONTENT_TYPE_HEADER, properties.getContentType());
    }
    headersFromProperties.put(MESSAGE_ID_HEADER, Long.toString(envelope.getDeliveryTag()));

    return headersFromProperties;
}
 
Example 2
Source File: Metadata.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
public Builder(@Nullable BasicProperties p) {
    if(p == null) return;
    this.contentType = p.getContentType();
    this.contentEncoding = p.getContentEncoding();
    this.headers = p.getHeaders();
    this.deliveryMode = p.getDeliveryMode();
    this.priority = p.getPriority();
    this.correlationId = p.getCorrelationId();
    this.replyTo = p.getReplyTo();
    this.expiration = p.getExpiration();
    this.timestamp = p.getTimestamp();
    this.type = p.getType();
    this.userId = p.getUserId();
    this.appId = p.getAppId();
}
 
Example 3
Source File: QueueClient.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
private static void mergeProperties(Metadata to, BasicProperties from) {
    if(from.getMessageId() != null) to.setMessageId(from.getMessageId());
    if(from.getDeliveryMode() != null) to.setDeliveryMode(from.getDeliveryMode());
    if(from.getExpiration() != null) to.setExpiration(from.getExpiration());
    if(from.getCorrelationId() != null) to.setCorrelationId(from.getCorrelationId());
    if(from.getReplyTo() != null) to.setReplyTo(from.getReplyTo());

    final Map<String, Object> headers = from.getHeaders();
    if(headers != null && !headers.isEmpty()) {
        to.setHeaders(MapUtils.merge(to.getHeaders(), headers));
    }
}
 
Example 4
Source File: Metadata.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public Metadata(BasicProperties p) {
    this(p.getContentType(), p.getContentEncoding(), p.getHeaders(), p.getDeliveryMode(), p.getPriority(), p.getCorrelationId(), p.getReplyTo(), p.getExpiration(), p.getMessageId(), p.getTimestamp(), p.getType(), p.getUserId(), p.getAppId());
}