|
|
|
@ -26,16 +26,16 @@ import static io.protostuff.MapSchema.MessageFactories.HashMap;
|
|
|
|
|
public class RabbitMqConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){ |
|
|
|
|
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory) { |
|
|
|
|
RabbitTemplate template = new RabbitTemplate(); |
|
|
|
|
template.setConnectionFactory(connectionFactory); |
|
|
|
|
template.setMandatory(true); |
|
|
|
|
template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { |
|
|
|
|
@Override |
|
|
|
|
public void confirm(CorrelationData correlationData, boolean b, String s) { |
|
|
|
|
System.out.println("确认回调-相关数据:"+correlationData); |
|
|
|
|
System.out.println("确认回调-确认情况:"+b); |
|
|
|
|
System.out.println("确认回调-原因:"+s); |
|
|
|
|
System.out.println("确认回调-相关数据:" + correlationData); |
|
|
|
|
System.out.println("确认回调-确认情况:" + b); |
|
|
|
|
System.out.println("确认回调-原因:" + s); |
|
|
|
|
// Long id = Long.parseLong(correlationData.getId());
|
|
|
|
|
// UpdateWrapper<PanOrderStatusLog> updateWrapper = new UpdateWrapper<>();
|
|
|
|
|
// if(b){
|
|
|
|
@ -57,40 +57,43 @@ public class RabbitMqConfiguration {
|
|
|
|
|
public void returnedMessage(ReturnedMessage returnedMessage) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if("mt_business_data_2_factory_exchange-pref".equals(returnedMessage.getExchange())){ |
|
|
|
|
return ; |
|
|
|
|
if ("mt_business_data_2_factory_exchange".equals(returnedMessage.getExchange()) || "mt_business_data_clerk_check_2_factory_exchange".equals(returnedMessage.getExchange())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
System.out.println("返回回调-消息:"+returnedMessage.getMessage()); |
|
|
|
|
System.out.println("返回回调-回应码:"+returnedMessage.getReplyCode()); |
|
|
|
|
System.out.println("返回回调-回应信息:"+returnedMessage.getReplyText()); |
|
|
|
|
System.out.println("返回回调-交换机:"+returnedMessage.getExchange()); |
|
|
|
|
System.out.println("返回回调-路由键:"+returnedMessage.getRoutingKey()); |
|
|
|
|
System.out.println("返回回调-消息:" + returnedMessage.getMessage()); |
|
|
|
|
System.out.println("返回回调-回应码:" + returnedMessage.getReplyCode()); |
|
|
|
|
System.out.println("返回回调-回应信息:" + returnedMessage.getReplyText()); |
|
|
|
|
System.out.println("返回回调-交换机:" + returnedMessage.getExchange()); |
|
|
|
|
System.out.println("返回回调-路由键:" + returnedMessage.getRoutingKey()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return template; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public DirectExchange errorMessageExchange(){ |
|
|
|
|
public DirectExchange errorMessageExchange() { |
|
|
|
|
return new DirectExchange(RabbitConstant.ERROR_EXCHANGE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Queue errorQueue(){ |
|
|
|
|
public Queue errorQueue() { |
|
|
|
|
return new Queue(RabbitConstant.ERROR_QUEUE, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Binding errorBinding(Queue errorQueue, DirectExchange errorMessageExchange){ |
|
|
|
|
public Binding errorBinding(Queue errorQueue, DirectExchange errorMessageExchange) { |
|
|
|
|
return BindingBuilder.bind(errorQueue).to(errorMessageExchange).with(RabbitConstant.ERROR_ROUTING); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 消费失败队列 |
|
|
|
|
* |
|
|
|
|
* @param rabbitTemplate |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Bean |
|
|
|
|
public MessageRecoverer republishMessageRecoverer(RabbitTemplate rabbitTemplate){ |
|
|
|
|
public MessageRecoverer republishMessageRecoverer(RabbitTemplate rabbitTemplate) { |
|
|
|
|
return new RepublishMessageRecoverer(rabbitTemplate, RabbitConstant.ERROR_EXCHANGE, RabbitConstant.ERROR_ROUTING); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -239,10 +242,6 @@ public class RabbitMqConfiguration {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Queue oupaiTestReceivingQueue() { |
|
|
|
|
return new Queue(RabbitConstant.TEST_RECEIVE_INFO_QUEUE, true); |
|
|
|
@ -296,18 +295,18 @@ public class RabbitMqConfiguration {
|
|
|
|
|
return BindingBuilder.bind(syncOldDataQueue).to(syncOldDataExchange).with(RabbitConstant.SYNC_OLD_DATA_ROUTING).noargs(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**************梦天扫描延迟推送 start****************/ |
|
|
|
|
/**************梦天扫描延迟推送 start****************/ |
|
|
|
|
@Bean |
|
|
|
|
public Queue mtBusinessData2FactoryQueue() { |
|
|
|
|
Map<String, Object> args =Maps.newHashMap(); |
|
|
|
|
args.put("x-message-ttl",5000); |
|
|
|
|
return new Queue(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_QUEUE,true,false,false,args); |
|
|
|
|
Map<String, Object> args = Maps.newHashMap(); |
|
|
|
|
args.put("x-message-ttl", 5000); |
|
|
|
|
return new Queue(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_QUEUE, true, false, false, args); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public CustomExchange mtBusinessData2FactoryExchange() { |
|
|
|
|
Map<String, Object> args =Maps.newHashMap(); |
|
|
|
|
Map<String, Object> args = Maps.newHashMap(); |
|
|
|
|
|
|
|
|
|
args.put("x-delayed-type", "direct"); |
|
|
|
|
return new CustomExchange(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_EXCHANGE, |
|
|
|
@ -323,48 +322,49 @@ public class RabbitMqConfiguration {
|
|
|
|
|
/**************梦天扫描延迟推送 end****************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************梦天扫描延迟推送 start****************/ |
|
|
|
|
@Bean |
|
|
|
|
public Queue mtBusinessDataClerkCheck2FactoryQueue() { |
|
|
|
|
Map<String, Object> args =Maps.newHashMap(); |
|
|
|
|
args.put("x-message-ttl",5000); |
|
|
|
|
return new Queue(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE,true,false,false,args); |
|
|
|
|
Map<String, Object> args = Maps.newHashMap(); |
|
|
|
|
args.put("x-message-ttl", 5000); |
|
|
|
|
return new Queue(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE, true, false, false, args); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Queue normalQueue() { |
|
|
|
|
return new Queue("normal_queue", true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public CustomExchange normalExchange() { |
|
|
|
|
public CustomExchange mtBusinessDataClerkCheck2FactoryExchange() { |
|
|
|
|
Map<String, Object> args = Maps.newHashMap(); |
|
|
|
|
|
|
|
|
|
args.put("x-delayed-type", "direct"); |
|
|
|
|
return new CustomExchange("normal_exchange", "x-delayed-message", true, false, args); |
|
|
|
|
return new CustomExchange(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE, |
|
|
|
|
"x-delayed-message", true, false, args); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Binding normalBinding(Queue normalQueue, CustomExchange normalExchange) { |
|
|
|
|
return BindingBuilder.bind(normalQueue).to(normalExchange).with("normal_routerkey").noargs(); |
|
|
|
|
public Binding mtBusinessDataClerkCheck2FactoryBinding(Queue mtBusinessDataClerkCheck2FactoryQueue, CustomExchange mtBusinessDataClerkCheck2FactoryExchange) { |
|
|
|
|
return BindingBuilder.bind(mtBusinessDataClerkCheck2FactoryQueue).to(mtBusinessDataClerkCheck2FactoryExchange).with(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_ROUTING).noargs(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public CustomExchange mtBusinessDataClerkCheck2FactoryExchange() { |
|
|
|
|
Map<String, Object> args =Maps.newHashMap(); |
|
|
|
|
/**************梦天扫描延迟推送 end****************/ |
|
|
|
|
|
|
|
|
|
args.put("x-delayed-type", "direct"); |
|
|
|
|
return new CustomExchange(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE, |
|
|
|
|
"x-delayed-message", true, false, args); |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Queue normalQueue() { |
|
|
|
|
return new Queue("normal_queue", true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Binding mtBusinessDataClerkCheck2FactoryBinding(Queue mtBusinessData2FactoryQueue, CustomExchange mtBusinessData2FactoryExchange) { |
|
|
|
|
return BindingBuilder.bind(mtBusinessData2FactoryQueue).to(mtBusinessData2FactoryExchange).with(RabbitConstant.MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_ROUTING).noargs(); |
|
|
|
|
|
|
|
|
|
public CustomExchange normalExchange() { |
|
|
|
|
Map<String, Object> args = Maps.newHashMap(); |
|
|
|
|
args.put("x-delayed-type", "direct"); |
|
|
|
|
return new CustomExchange("normal_exchange", "x-delayed-message", true, false, args); |
|
|
|
|
} |
|
|
|
|
/**************梦天扫描延迟推送 end****************/ |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public Binding normalBinding(Queue normalQueue, CustomExchange normalExchange) { |
|
|
|
|
return BindingBuilder.bind(normalQueue).to(normalExchange).with("normal_routerkey").noargs(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|