0 Replies Latest reply: Sep 13, 2013 2:07 PM by Mauricio Arango RSS

    Inbound JMS adapter with MapMessage

    Mauricio Arango

      I'm sharing the following problem and solution with using the OEP inbound message adapter because it may be

      a common situation occurring to other users.

       

      Recently was using the inbound JMS adapter with its default (OEP internal) converter from JMS MapMessage

      messages to OEP events. The inbound adapter was receiving MapMessage messages but it was not assigning

      values to the corresponding attributes in the specified input event instance.

       

      The problem was that I was not properly creating the MapMessage messages in the JMS producer client.

      I was using method setStringProperty() instead of method setString(), which is what is needed to set name/value

      pairs of type String, and similarly with other primitive Java data types. Here's a code snippet for building and sending

      a MapMessage on the client side:

       

            try {

            mapm = qsess.createMapMessage();

          

            mapm.setString("valueType1", "value1");

            mapm.setString("valueType2", "value2");

            mapm.setInt("valueType3", 5);

          

            producer.send(mapm);

           } catch (JMSException jmse) {

           jmse.printStackTrace(System.err);

           System.exit(0);

           }

       

      Regards,

       

      Mauricio