如何像在春天的@JmsListener一样在micronaut中创建自定义注释并为其实现逻辑?
@Component
public class ArtemisCusumer {
@JmsListener(destination = "someQueue")
public void processMessage(String content) throws Exception {
System.out.println("recivemessage:"+content);
throw new Exception("not ok");
}
@JmsListener(destination = "DLQ")
public void dlq(String content) throws Exception {
System.out.println("dlq:"+content);
}
}
答案 0 :(得分:0)
文档说明了如何编写AOP建议
https://docs.micronaut.io/latest/guide/index.html#aop
您可以查看包括Kafka和RabbitMQ在内的几种实现方式
https://github.com/micronaut-projects/micronaut-kafka https://github.com/micronaut-projects/micronaut-rabbitmq