You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Justin Stewart <ju...@lmco.com> on 2008/01/21 23:46:07 UTC

Correlation problem with servicemix-jms provider

Hi, all.
I am attempting to provide a service outside of servicemix using the
servicemix-jms binding component.  The xbean.xml I am using is the
following:

<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
       xmlns:test="http://test"
       xmlns:bais="urn:com.bais">
    <jms:endpoint service="bais:JMSTestProvider"
                  endpoint="myProvider"
                  role="provider" 
                  destinationStyle="queue"
                  jmsProviderDestinationName="queue/A"
                  connectionFactory="#connectionFactory"/>
    <bean id="connectionFactory"
    	class="org.apache.activemq.ActiveMQConnectionFactory">
    	<property name="brokerURL" value="tcp://localhost:61616" />
    </bean>   
</beans>

That part appears to be working.
I downloaded ActiveMQ 5.0 and am using the ConsumerTool example to provide a
test service.  It appears to work.  I've introduced a message into
ServiceMix which is properly routed through the jms binding component and
the ConsumerTool correctly outputs the message content.  However, when
ConsumerTool responds using:
            if (message.getJMSReplyTo() != null) {
                replyProducer.send(message.getJMSReplyTo(), 
                		session.createTextMessage("<reply>" +
message.getJMSMessageID() + "</reply>"));
            }

ServiceMix throws the following exception:

ERROR - MultiplexingProviderProcessor  - Error while handling jms message
java.lang.NullPointerException
        at
edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:160)
        at
edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:923)
        at
org.apache.servicemix.jms.multiplexing.MultiplexingProviderProcessor$1.run(MultiplexingProviderProcessor.java:107)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)

When I look into the ServiceMix source at
MultiplexingProviderProcessor.java:107, it's breaking at 

InOut exchange = (InOut)
pendingExchanges.remove(message.getJMSCorrelationID());

In short, there is no correlation entry in the Map to associate the JMS
reply with.
Can anyone shed some light on what I might be doing wrong?

Thanks.
Justin
-- 
View this message in context: http://www.nabble.com/Correlation-problem-with-servicemix-jms-provider-tp15008454s12049p15008454.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Correlation problem with servicemix-jms provider

Posted by Justin Stewart <ju...@lmco.com>.
Thanks - that did the trick ...


gnodet wrote:
> 
> Did you set the correlation id before sending the response ?
> 
>            if (message.getJMSReplyTo() != null) {
>                Message reply = session.createTextMessage("<reply>" +
> message.getJMSMessageID() + "</reply>");
>                reply.setJMSCorrelationID(message.getJMSCorrelationID());
>                replyProducer.send(message.getJMSReplyTo(), reply);
>            }
> 
> AFAIK, the correlation id is not set by default, so you have to
> explicitely
> set it to the correct value so that servicemix can correlate the response
> and the request.
> ...
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Correlation-problem-with-servicemix-jms-provider-tp15008454s12049p15008858.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Correlation problem with servicemix-jms provider

Posted by Guillaume Nodet <gn...@gmail.com>.
Did you set the correlation id before sending the response ?

           if (message.getJMSReplyTo() != null) {
               Message reply = session.createTextMessage("<reply>" +
message.getJMSMessageID() + "</reply>");
               reply.setJMSCorrelationID(message.getJMSCorrelationID());
               replyProducer.send(message.getJMSReplyTo(), reply);
           }

AFAIK, the correlation id is not set by default, so you have to explicitely
set it to the correct value so that servicemix can correlate the response
and the request.

On Jan 21, 2008 11:46 PM, Justin Stewart <ju...@lmco.com> wrote:

>
> Hi, all.
> I am attempting to provide a service outside of servicemix using the
> servicemix-jms binding component.  The xbean.xml I am using is the
> following:
>
> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>       xmlns:test="http://test"
>       xmlns:bais="urn:com.bais">
>    <jms:endpoint service="bais:JMSTestProvider"
>                  endpoint="myProvider"
>                  role="provider"
>                  destinationStyle="queue"
>                  jmsProviderDestinationName="queue/A"
>                  connectionFactory="#connectionFactory"/>
>    <bean id="connectionFactory"
>        class="org.apache.activemq.ActiveMQConnectionFactory">
>        <property name="brokerURL" value="tcp://localhost:61616" />
>    </bean>
> </beans>
>
> That part appears to be working.
> I downloaded ActiveMQ 5.0 and am using the ConsumerTool example to provide
> a
> test service.  It appears to work.  I've introduced a message into
> ServiceMix which is properly routed through the jms binding component and
> the ConsumerTool correctly outputs the message content.  However, when
> ConsumerTool responds using:
>            if (message.getJMSReplyTo() != null) {
>                replyProducer.send(message.getJMSReplyTo(),
>                                session.createTextMessage("<reply>" +
> message.getJMSMessageID() + "</reply>"));
>            }
>
> ServiceMix throws the following exception:
>
> ERROR - MultiplexingProviderProcessor  - Error while handling jms message
> java.lang.NullPointerException
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap.hash(
> ConcurrentHashMap.java:160)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap.remove(
> ConcurrentHashMap.java:923)
>        at
> org.apache.servicemix.jms.multiplexing.MultiplexingProviderProcessor$1.run
> (MultiplexingProviderProcessor.java:107)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> ThreadPoolExecutor.java:885)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java
> :907)
>        at java.lang.Thread.run(Thread.java:619)
>
> When I look into the ServiceMix source at
> MultiplexingProviderProcessor.java:107, it's breaking at
>
> InOut exchange = (InOut)
> pendingExchanges.remove(message.getJMSCorrelationID());
>
> In short, there is no correlation entry in the Map to associate the JMS
> reply with.
> Can anyone shed some light on what I might be doing wrong?
>
> Thanks.
> Justin
> --
> View this message in context:
> http://www.nabble.com/Correlation-problem-with-servicemix-jms-provider-tp15008454s12049p15008454.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/