3 Replies Latest reply on May 21, 2013 8:47 AM by Bradley Snyder

    Simple JMS Problem with JAX-RS Endpoint Sender

    Bradley Snyder Newbie

      JBoss AS 7.1.1.Final, Java SE 1.7 runtime

       

      Hey everyone,

       

      I'm relatvely new to JBoss/Java EE and know just enough to be dangerous. I have an issue I can't seem to get past where a JAX-RS class seems to be succeeding sending a JMS message, but the JBoss admin console and an associated MDB never see the message. I've verified the REST request is reaching the appropriate method in the JAX-RS class, and that code is as follows:

       

      Connection connection = null;

      @Resource(lookup = "java:/ConnectionFactory")

      private ConnectionFactory connectionFactory;

      @Resource(lookup = "topic/database_update")

      private Topic topic;

       

      public Response testJmsMessage(int randomVariable) {

           System.out.println("Reached the method");

       

           Session session = null;

           MessageProducer publisher = null;

           TextMessage message = null;

       

           try {

                session = connection.createSession(true, 1);

                publisher = session.createProducer(topic);

                message = session.createTextMessage();

       

                message.setText("message created");

                System.out.println("Created message: " + message.getText());

                publisher.send(message);

           } catch (Exception e) { close resources }

           return Response.created(null).build();

      }

       

      The MDB's declaration is:

      @MessageDriven( activationConfig = {

           @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

           @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/database_update"),

           @activationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")

      {)

       

      Finally, in standalone-full.xml:

       

      <jms-topic name="database_update">

           <entry name="topic/database_update"/>

           <entry name="java:jboss/exported/jms/topic/database_update"/>

      </jms-topic>

       

      I see all the printouts I configured in the server console when I send the request. I have similar printouts in the MDB but I never see those, and the MDB is deployed properly. In the Admin Console's Runtime section, I went to JMS Destinatinos and verified that it is seeing the subscriber for the database_update topic in the Subscriptions tab. However, the Messages tab counters remain at zero. As far as I can tell publisher.send() is "succeeding", but no message is being sent and thus the MDB can't see anything. I have other MDBs configured to look at an external hornetq server using the connectionParameters ActivationConfigProperty and those work fine...it's just connecting to my own jboss as server that seems to have some sort of issue. Any ideas on how to get this message across? Thanks for any help.