监听延迟消息
This commit is contained in:
parent
2dd828d4ef
commit
51d69e2dd2
|
@ -0,0 +1,22 @@
|
||||||
|
package com.example.rabbitmq.listener;
|
||||||
|
|
||||||
|
import com.example.rabbitmq.config.MqConfig;
|
||||||
|
import com.rabbitmq.client.impl.AMQContentHeader;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class ListenerLazy {
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(value = "lazy.queue", durable = "true"),
|
||||||
|
exchange = @Exchange(value = "lazy.exchange", durable = "true", type = "topic"),
|
||||||
|
key = "hi"))
|
||||||
|
public void listenLazy(String message) {
|
||||||
|
log.info("listener收到【lazy.queue】:{}", message);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue