Package io.micronaut.jms.annotations
Annotation Interface Queue
@Documented
@Retention(RUNTIME)
@Target(METHOD)
@Executable(processOnStartup=true)
@MessageMapping
public @interface Queue
Binds a
Queue
to a method for receiving or sending a Message
.
Usage:
@JMSListener("myConnectionFactory") public class Listener { @Queue( destination = "my-queue", executor = "micronaut-executor-service" ) public <T> void handle(T body, @Header(JMSHeaders.JMS_MESSAGE_ID) String messageID) { // do some logic with body and messageID } @Queue( destination = "my-queue-2", concurrency = "1-5", transacted = true, acknowledgeMode = Session.CLIENT_ACKNOWLEDGE ) public <T> void handle(T body, @Header("X-Arbitrary-Header") String arbitraryHeader) { // do some logic with body and arbitraryHeader } }
- Since:
- 1.0.0
- Author:
- Elliott Pope
-
Required Element Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionint
Deprecated.since 3.0.0, to align the implementation with the JMS model and the messaging libraries' presumptions.Class<? extends JMSListenerErrorHandler>[]
The error handlers to be injected into the message handling logic.Deprecated.since 3.0.0, to align the implementation with the JMS model and the messaging libraries' presumptions.The name of aSerializer
in the bean context to use to serialize an object into aMessage
when sending.Class<? extends JMSListenerSuccessHandler>[]
The success handlers to be injected into the message handling logic.boolean
Whether message receipt is transacted.
-
Element Details
-
value
@AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class, member="value") String valueThe name of the queue to target.- Returns:
- the name
-
-
-
concurrency
Deprecated.since 3.0.0, to align the implementation with the JMS model and the messaging libraries' presumptions.The size of the thread pool to use when used in conjunction withJMSListener
. The value must be of the form x-y where x is the initial size of the thread pool and y is the maximum size. If this option is specified, a new thread pool will be created and destroyed with theJMSListener
. This option cannot be used in conjunction withexecutor()
; if both are specified theexecutor()
value will be used.- Returns:
- the initial and max size of the thread pool
- Default:
- "1-1"
-
serializer
String serializerThe name of aSerializer
in the bean context to use to serialize an object into aMessage
when sending. If not specified, defaults toDefaultSerializerDeserializer
.- Returns:
- the serializer bean name
- Default:
- ""
-
executor
Deprecated.since 3.0.0, to align the implementation with the JMS model and the messaging libraries' presumptions.The name of anExecutorService
in the bean context to execute tasks on when receiving aMessage
as part of aJMSListener
. The executor can be maintained by Micronaut using theUserExecutorConfiguration
.- Returns:
- the executor service bean name
- Default:
- ""
-
acknowledgeMode
int acknowledgeMode- Returns:
- the acknowledge mode for the
JMSListener
. - See Also:
-
Session
- Default:
- 1
-
transacted
boolean transactedWhether message receipt is transacted. The broker must support transacted sessions.- Returns:
- true if transacted
- See Also:
-
Session
- Default:
- false
-
messageSelector
String messageSelector- Returns:
- the message selector for the queue
- Default:
- ""
-
successHandlers
Class<? extends JMSListenerSuccessHandler>[] successHandlersThe success handlers to be injected into the message handling logic.- Returns:
- the classes of the success handlers to be added. These handlers must be present as
Singleton
instances. - Since:
- 3.0.0
- Default:
- {}
-
errorHandlers
Class<? extends JMSListenerErrorHandler>[] errorHandlersThe error handlers to be injected into the message handling logic.- Returns:
- the classes of the error handlers to be added. These handlers must be present as
Singleton
instances. - Since:
- 3.0.0
- Default:
- {}
-