Quantcast
Channel: Spring Community Forums - JMS
Viewing all articles
Browse latest Browse all 51

Retrieving JMS MapMessage from ActiveMQ with Spring-Integration

$
0
0
Good Morning,

I'm developing comunication between a Server and a Node applications using ActiveMQ and JMS MapMessages. On Server i'm using Spring-Integration to retrieve messages from a Queue. On Node i'm using JMS directly.

My MapMessage contains some "message properties" that identifies the included content , also contais the message main body using some "body properties". Here is an example:

Code:


MapMessage mensaje = sesion.createMapMessage();

// MESSAGE PROPERTIES
mensaje.setStringProperty("ID_NODO", "1");
mensaje.setBooleanProperty("BROADCAST", Boolean.FALSE);           
mensaje.setStringProperty("TYPE", "ReadWriteMessage");


// BODY
mensaje.setString("ID_SIGNAL", "12");
mensaje.setString("VALUE", "5");

The Spring-Integration configuration is:
Code:


<bean id="activeMQConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
        <value>${mq.broker.url}</value>
    </property>
</bean>


<bean id="recieveQueue" class="org.apache.activemq.command.ActiveMQQueue"
      autowire="constructor">
    <constructor-arg value="${MQ_QUEUE_RECIEVE_FROM}" />
</bean>


<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
        <ref local="activeMQConnectionFactory"/>
    </property>
    <property name="defaultDestination">           
        <ref  local="sendQueue"/>
    </property>
 </bean>
 
<bean id="myListener" class="es.example.MyListener"/>       

<integration:channel id="asyncJMSInboundChannel" />

<jms:message-driven-channel-adapter
            channel="asyncJMSInboundChannel"
            destination="recieveQueue"
            connection-factory="activeMQConnectionFactory" />

<integration:service-activator
            input-channel="asyncJMSInboundChannel"
            ref="myListener"
            method="receiveAsyncMessageFromMQ"/>

Node sends a MapMessage to Server correctly, but when Server retrieves the message from ActiveMQ with Spring-Integration, the object retrieved is a HashMap instead a MapMessage. Recieved message only contains the body properties but any other message properties Node's set.

For example, using the above code values, the HashMap contect would be:

[ID_SIGNAL],[12]
[VALUE],[5]

What has happened with Message properties? How could I retrieve them?

Thank you very much!

Best regards,
Rafa.

Viewing all articles
Browse latest Browse all 51

Trending Articles