JBoss.orgCommunity Documentation
In this chapter we'll look at how to inject some of the common JMS resource types.
The following JMS resources are now available for injection:
Destination-based resources:
The injection of resources that are themselves a javax.jms.Destination or require one needs
a hint: What destination do you want to work with? This is provided by the
@JmsDestination annotatation.
@Inject @JmsDestination(jndiName="jms/MyTopic") Topic t; @Inject @JmsDestination(jndiName="jms/MyQueue") Queue q;
You should create your own qualifier to provide type safe injection of predefined destinations:
@Qualifier
@JmsDestination(jndiName = "jms/MyTopic")
public @interface MyTopic {}
You can then use it in place of the @JmsDestination qualifier anywhere it's required:
@Inject @MyTopic TopicPublisher myPub; ... @Inject @MyTopic Topic myTopic;
You can use the @JmsSession qualifier when injecting javax.jms.Session to specify transacted and acknowledgement type:
@Inject @JmsSession(transacted=true, acknowledgementType=Session.CLIENT_ACKNOWLEDGE) Session s;
TODO Add other configuration options as they are implemented.