Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-13818

[CD13][Documentation] Document using of @Resource with JMS resources

XMLWordPrintable

      Please, document usage of @Resource annotation for injecting JMS resources.
      Client (EJB) can inject JMS destinations / connection factories using @Resource annotation.
      In @Resouce annotations following parameter can be specified

      • lookup
      • name
      • mappedName

      To inject resource, you can specify resource JNDI name in one of this parameters.

      Example of queue resource injection

      Queue definition
      <jms-queue name="OutQueue" entries="jms/queue/OutQueue java:jboss/exported/jms/queue/OutQueue"/>
      

      You can inject this queue by any annotating

      {javax.jms.Queue}

      property by any of following annotations

      Injection
          @Resource(lookup = "java:jboss/exported/jms/queue/OutQueue")
          @Resource(lookup = "java:/jms/queue/OutQueue")
      
          @Resource(name = "java:jboss/exported/jms/queue/OutQueue")
          @Resource(name = "java:/jms/queue/OutQueue")
      
          @Resource(mappedName = "java:jboss/exported/jms/queue/OutQueue")
          @Resource(mappedName = "java:/jms/queue/OutQueue")
      

      Injection of connection factory is similar
      Default

      {activemq-ra}

      pooled connection factory can by injected like this

      CF injection
          @Resource(lookup = "java:/JmsXA")
          private ConnectionFactory cf;
      

              snelluli@redhat.com Sreelatha Nelluli
              mstyk_jira Martin Styk (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days
                  4d