Java Code Examples for com.rabbitmq.client.AMQP.BasicProperties#Builder

The following examples show how to use com.rabbitmq.client.AMQP.BasicProperties#Builder . 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: RabbitMqBenchmarkProducer.java    From openmessaging-benchmark with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<Void> sendAsync(Optional<String> key, byte[] payload) {
    BasicProperties.Builder builder = defaultProperties.builder().timestamp(new Date());
    if (messagePersistence) {
        builder.deliveryMode(2);
    }
    BasicProperties props = builder.build();
    CompletableFuture<Void> future = new CompletableFuture<>();
    long msgId = channel.getNextPublishSeqNo();
    ackSet.add(msgId);
    futureConcurrentHashMap.putIfAbsent(msgId, future);
    try {
        channel.basicPublish(exchange, key.orElse(""), props, payload);
    } catch (Exception e) {
        future.completeExceptionally(e);
    }

    return future;
}
 
Example 2
Source File: EventPublisherTest.java    From rabbitmq-cdi with MIT License 5 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
  publisher = new EventPublisher(connectionRepository);
  basicProperties = new BasicProperties.Builder();
  encoder = new JsonEncoder<>();
  routingKeyFunction = e -> "routingKey";
}
 
Example 3
Source File: AgentManagementServiceImpl.java    From Insights with Apache License 2.0 4 votes vote down vote up
private BasicProperties getBasicProperties(Map<String, Object> headers) {
	BasicProperties.Builder propertiesBuilder = new BasicProperties.Builder();
	propertiesBuilder.headers(headers);
	return propertiesBuilder.build();
}
 
Example 4
Source File: MessageProperties.java    From zstack with Apache License 2.0 4 votes vote down vote up
public BasicProperties toBasicProperties() {
    BasicProperties.Builder builder = new BasicProperties.Builder();
    return builder.appId(appId).clusterId(clusterId).contentEncoding(contentEncoding).contentType(contentType).correlationId(correlationId)
            .deliveryMode(deliveryMode).expiration(expiration).headers(headers).messageId(messageId).priority(priority).replyTo(replyTo)
            .timestamp(timestamp).type(type).userId(userId).build();
}