|
@@ -0,0 +1,43 @@
|
|
|
+package org.jeecg.modules.adweb.enquiry.mq;
|
|
|
+
|
|
|
+import com.rabbitmq.client.Channel;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
|
|
+import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
|
|
+import org.jeecg.common.annotation.RabbitComponent;
|
|
|
+import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
|
|
|
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
|
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
+import org.springframework.amqp.support.AmqpHeaders;
|
|
|
+import org.springframework.messaging.handler.annotation.Header;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Rabbit MQ - 询盘消息接收
|
|
|
+ *
|
|
|
+ * @author wfansh
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RabbitComponent(value = "enquiryReceiver")
|
|
|
+public class EnquiryReceiver extends BaseRabbiMqHandler<EnquiryDTO> {
|
|
|
+
|
|
|
+ @RabbitHandler
|
|
|
+ @RabbitListener(queues = "enquiry")
|
|
|
+ public void onMessage(
|
|
|
+ EnquiryDTO enquiryDTO,
|
|
|
+ Channel channel,
|
|
|
+ @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
|
|
+ super.onMessage(
|
|
|
+ enquiryDTO,
|
|
|
+ deliveryTag,
|
|
|
+ channel,
|
|
|
+ new MqListener<EnquiryDTO>() {
|
|
|
+ @Override
|
|
|
+ public void handler(EnquiryDTO enquiry, Channel channel) {
|
|
|
+ // 业务处理
|
|
|
+ log.info("收到MQ消息 {}", enquiry);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|