zzsoszz
zzsoszz

Reputation: 11

how to create customized annotation in micronaut?

how to create customized annotation and implement logic for it in micronaut just like @JmsListener in spring ?

@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);
    }

}

Upvotes: 0

Views: 2217

Answers (1)

James Kleeh
James Kleeh

Reputation: 12238

The documentation explains how to write AOP advice

https://docs.micronaut.io/latest/guide/index.html#aop

There are several implementations you can look at including Kafka and RabbitMQ

https://github.com/micronaut-projects/micronaut-kafka https://github.com/micronaut-projects/micronaut-rabbitmq

Upvotes: 2

Related Questions