Configure / enter JMS factory connection and theme in WildFly

I would like to do some experiments with JMS on jBoss WildFly 8.2.

The WildFly configuration file standalone-full.xmlhas the following fragments by default:

<hornetq-server>

    <connectors>
        ...
        <in-vm-connector name="in-vm" server-id="0"/>
    </connectors>

        ...

    <jms-connection-factories>
        <connection-factory name="InVmConnectionFactory">
            <connectors>
                <connector-ref connector-name="in-vm"/>
            </connectors>
            <entries>
                <entry name="java:/ConnectionFactory"/>
            </entries>
        </connection-factory>
        ...
    </jms-connection-factories>

    <jms-destinations>
         <!-- this destination I have added myself as I need a "topic", but 
                the default configuration has only two preconfigured "queues". -->
        <jms-topic name="MyTestTopic">
            <entry name="java:/jms/topic/MyTestTopic"/>
        </jms-topic>
    </jms-destinations>

</hornetq-server>

I am trying to introduce this factory connection and this question in EJB as follows:

@Stateless
public class JmsPublisher {

    @Resource(mappedName = "java:/ConnectionFactory")
    ConnectionFactory jmsConnectionFactory;

    @Resource(mappedName = "java:/jms/topic/MyTestTopic")
    Topic topic;

But during deployment, the following error message appears:

Operation ("deploy") failed ... Services with missing/unavailable dependencies" => ...

...JmsPublisher\".jmsConnectionFactory is missing [jboss.naming.context.java.ConnectionFactory]"
...JmsPublisher\".topic is missing [jboss.naming.context.java.jms.topic.MyTestTopic]"

What am I doing wrong?

+4
source share
2 answers

You must enter your destination / connection enterprises with mappedName, and you can consider the new JMS 2.0 APIs -JMSContext

@Resource(mappedName = "java:/topic/someTopic")
private Topic topic;

Assuming you have a record like this

<jms-topic name="someTopic">
 <entry name="topic/someTopic"/>
</jms-topic>

@Resource
private ConnectionFactory connectionFactory;

, @Inject JMSContext context , .

+4

, standalone.xml - Java EE , standalone-full.xml Java EE Full-Profile.

, JMS factory JMS standalone-full.xml. jBoss WildFly standalone.xml.

, WildFly standalone-full.xml standalone.xml. standalone-full.xml .

+2

All Articles