use of org.springframework.amqp.rabbit.support.CorrelationData in project spring-integration by spring-projects.
the class AmqpOutboundEndpoint method handleRequestMessage.
@Override
protected Object handleRequestMessage(Message<?> requestMessage) {
CorrelationData correlationData = generateCorrelationData(requestMessage);
String exchangeName = generateExchangeName(requestMessage);
String routingKey = generateRoutingKey(requestMessage);
if (this.expectReply) {
return this.sendAndReceive(exchangeName, routingKey, requestMessage, correlationData);
} else {
this.send(exchangeName, routingKey, requestMessage, correlationData);
return null;
}
}
use of org.springframework.amqp.rabbit.support.CorrelationData in project spring-integration by spring-projects.
the class AsyncAmqpOutboundGateway method handleRequestMessage.
@Override
protected Object handleRequestMessage(Message<?> requestMessage) {
org.springframework.amqp.core.Message amqpMessage = MappingUtils.mapMessage(requestMessage, this.messageConverter, getHeaderMapper(), getDefaultDeliveryMode(), isHeadersMappedLast());
addDelayProperty(requestMessage, amqpMessage);
RabbitMessageFuture future = this.template.sendAndReceive(generateExchangeName(requestMessage), generateRoutingKey(requestMessage), amqpMessage);
future.addCallback(new FutureCallback(requestMessage));
CorrelationData correlationData = generateCorrelationData(requestMessage);
if (correlationData != null && future.getConfirm() != null) {
future.getConfirm().addCallback(new CorrelationCallback(correlationData, future));
}
return null;
}
use of org.springframework.amqp.rabbit.support.CorrelationData in project spring-boot-quick by vector4wang.
the class CallBackSender method send.
public void send() {
rabbitTemplatenew.setConfirmCallback(this);
String msg = "callbackSender : i am callback sender";
System.out.println(msg);
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
System.out.println("callbackSender UUID: " + correlationData.getId());
this.rabbitTemplatenew.convertAndSend("exchange", "topic.messages", msg, correlationData);
}
use of org.springframework.amqp.rabbit.support.CorrelationData in project neweagle-api by apgzs.
the class MqSender method send.
// 发送消息,不需要实现任何接口,供外部调用。
public void send(String msg) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
log.info("开始发送消息 : " + msg.toLowerCase());
String response = rabbitTemplate.convertSendAndReceive("topicExchange", "key.1", msg, correlationId).toString();
log.info("结束发送消息 : " + msg.toLowerCase());
log.info("消费者响应 : " + response + " 消息处理完成");
}
use of org.springframework.amqp.rabbit.support.CorrelationData in project jim-framework by jiangmin168168.
the class ProductServiceImpl method save.
@Override
public void save(Product product) {
if (null == product.getId()) {
this.productMapper.insert(product);
} else {
this.productMapper.updateByPrimaryKey(product);
}
String uuid = UUID.randomUUID().toString();
CorrelationData correlationId = new CorrelationData(uuid);
rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME, RabbitMQConfig.ROUTING_KEY, product.getName(), correlationId);
}
Aggregations