Commit a8577563 by ping.wu

mq启动失败修改

parent 9c80729f
......@@ -20,6 +20,11 @@ public class DlPaymentMqConfig {
public static final String OPEN_STORE_PAYMENT_QUERY_KEY = "open_store_payment_query_key";
@Bean("dlPaymentMqTopicExchange")
public Exchange dlPaymentMqTopicExchange() {
return ExchangeBuilder.topicExchange(TopicExchangeConfig.EXCHANGE_NAME).durable(true).build();
}
/**
* 写入RabbitMQ使用的默认队列
*
......@@ -38,7 +43,7 @@ public class DlPaymentMqConfig {
* @return 消息队列绑定
*/
@Bean("bindingPaymentQueueChange")
Binding bindingPaymentChange(@Qualifier("paymentQueueName") Queue queue, @Qualifier("orderPushTopicExchange") Exchange topicExchange) {
Binding bindingPaymentChange(@Qualifier("paymentQueueName") Queue queue, @Qualifier("dlPaymentMqTopicExchange") Exchange topicExchange) {
return BindingBuilder.bind(queue).to(topicExchange).with(OPEN_STORE_PAYMENT_QUERY_KEY).noargs();
}
......@@ -56,7 +61,7 @@ public class DlPaymentMqConfig {
}
@Bean("bindingPaymentDlChange")
Binding bindingPaymentDlChange(@Qualifier("paymentChangeDlQueue") Queue queue, @Qualifier("orderPushTopicExchange") Exchange topicExchange) {
Binding bindingPaymentDlChange(@Qualifier("paymentChangeDlQueue") Queue queue, @Qualifier("dlPaymentMqTopicExchange") Exchange topicExchange) {
Map<String, Object> args = new HashMap<>(2);
args.put("x-dead-letter-exchange", TopicExchangeConfig.EXCHANGE_NAME);
args.put("x-dead-letter-routing-key", OPEN_STORE_PAYMENT_QUERY_KEY);
......
......@@ -3,6 +3,7 @@ package cn.freemud.service.impl;
import cn.freemud.amp.config.DlPaymentMqConfig;
import cn.freemud.amqp.Header;
import cn.freemud.amqp.MQMessage;
import cn.freemud.amqp.MQService;
import cn.freemud.entities.dto.pay.PaymentMqMessageDto;
import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.config.TopicExchangeConfig;
......@@ -15,8 +16,10 @@ import org.springframework.stereotype.Component;
@Component
public class PaymentQueueService {
// @Autowired
// private RabbitTemplate restTemplate;
@Autowired
private RabbitTemplate restTemplate;
private MQService mqService;
public void paymentCallback(PaymentMqMessageDto dto){
......@@ -32,6 +35,7 @@ public class PaymentQueueService {
messageProperties.setContentType(MessageProperties.CONTENT_TYPE_JSON);
Message delmessage = new Message(notifyMsgBytes, messageProperties);
// logger.info("restTemplate.convertAndSend:"+dto);
restTemplate.convertAndSend(TopicExchangeConfig.EXCHANGE_NAME, DlPaymentMqConfig.OPEN_STORE_PAYMENT_QUERY_DL_KEY, delmessage);
mqService.convertAndSend(TopicExchangeConfig.EXCHANGE_NAME, DlPaymentMqConfig.OPEN_STORE_PAYMENT_QUERY_DL_KEY, delmessage);
// restTemplate.convertAndSend(TopicExchangeConfig.EXCHANGE_NAME, DlPaymentMqConfig.OPEN_STORE_PAYMENT_QUERY_DL_KEY, delmessage);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment