@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
@Executable(processOnStartup=true)
@MessageMapping
public @interface Topic
Topic to a method for receiving or
sending a Message.
Usage:
@JMSListener("myConnectionFactory")
public class Listener {
@Topic("my-topic")
public <T> void handle(@Body T body, @Header(JMSHeaders.JMS_MESSAGE_ID) String messageID) {
// do some logic with body and messageID
}
@Topic("my-topic-2")
public <T> void handle(@Body T body, @Header("X-Arbitrary-Header") String arbitraryHeader) {
// do some logic with body and arbitraryHeader
}
}
| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String |
value
The name of the topic to target.
|
| Modifier and Type | Optional Element and Description |
|---|---|
int |
acknowledgeMode |
java.lang.String |
executor
The name of an
ExecutorService in the bean
context to execute tasks on when receiving a Message
as part of a JMSListener. |
java.lang.String |
serializer
The name of a
Serializer in the bean
context to use to serialize an object into a Message
when sending. |
boolean |
transacted
Whether message receipt is transacted.
|
@AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,
member="value")
public abstract java.lang.String value
public abstract java.lang.String executor
ExecutorService in the bean
context to execute tasks on when receiving a Message
as part of a JMSListener. The executor can be maintained by
Micronaut using the io.micronaut.scheduling.executor.UserExecutorConfiguration.public abstract java.lang.String serializer
Serializer in the bean
context to use to serialize an object into a Message
when sending. If not specified, defaults to
DefaultSerializerDeserializer.public abstract int acknowledgeMode
JMSListenerContainer.Session