You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sandra Schweighart <Sa...@Innovations.de> on 2006/05/17 10:21:52 UTC

confused about NMR routing

Hello,

I've got a general question because I recognised that more than one time
now:

I've installed my own JBI component to servicemix. This component
listens to the nmr via
exchange = channel.accept(5000);
in a never ending loop and receives messages that are sent to its
activated endpoint/service.

So far everything is ok. Now my component sends another message to an
endpoint/service that is registered in servicemix.xml by
<activation-spec>. There is no mistake but after some seconds MY
COMPONENT receives the message that was addressed to a completely
different service. Even the namespaces of the two services are
completely different. How can this be?

I attach some code snippets.

Thanks for your help
Sandra

servicemix.xml snippet:
------------------------------------------------------
<sm:activationSpec componentName="myJmsSender"
 service="off:myJmsSender">
<sm:component>
<bean class="org.apache.servicemix.components.jms.JmsSenderComponent">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="jmsFactory"/>
</property>
<property name="defaultDestinationName"
value="test.org.apache.servicemix.components.xslt.result"/>
<property name="pubSubDomain" value="true"/>
</bean>
</property>
</bean></sm:component>
</sm:activationSpec>

myComponent  snippet:
-----------------------------------------------------

QName service2 = new QName("http://servicemix.apache.org/services",
                    "myJmsSender");
exchange.setService(service2);
           
exchange.setEndpoint(context.getEndpoint(service2, "myJmsSender"));
channel.send(exchange);

Re: confused about NMR routing

Posted by Guillaume Nodet <gn...@gmail.com>.
When a JBI exchange is created by a component and sent, the exchange
go forth and back a number of times depending on the MEP (in-only,
in-out, etc..)
For an in-only MEP, the exchange will come back with a DONE status or
an ERROR status.  I guess you are receiving these messages.
You can check that using the role of the component for the exchange.
Take a look at http://svn.apache.org/repos/asf/incubator/servicemix/trunk/tooling/maven2/archetypes/servicemix-service-engine/src/main/resources/archetype-resources/src/main/java/MyEndpoint.java

If you use sendSync instead of send, the call will block until the
exchange status is received and thus, it will not be received from the
delivery channel.

Cheers,
Guillaume Nodet

On 5/17/06, Sandra Schweighart <Sa...@innovations.de> wrote:
> Hello,
>
> I've got a general question because I recognised that more than one time
> now:
>
> I've installed my own JBI component to servicemix. This component
> listens to the nmr via
> exchange = channel.accept(5000);
> in a never ending loop and receives messages that are sent to its
> activated endpoint/service.
>
> So far everything is ok. Now my component sends another message to an
> endpoint/service that is registered in servicemix.xml by
> <activation-spec>. There is no mistake but after some seconds MY
> COMPONENT receives the message that was addressed to a completely
> different service. Even the namespaces of the two services are
> completely different. How can this be?
>
> I attach some code snippets.
>
> Thanks for your help
> Sandra
>
> servicemix.xml snippet:
> ------------------------------------------------------
> <sm:activationSpec componentName="myJmsSender"
>  service="off:myJmsSender">
> <sm:component>
> <bean class="org.apache.servicemix.components.jms.JmsSenderComponent">
> <property name="template">
> <bean class="org.springframework.jms.core.JmsTemplate">
> <property name="connectionFactory">
> <ref local="jmsFactory"/>
> </property>
> <property name="defaultDestinationName"
> value="test.org.apache.servicemix.components.xslt.result"/>
> <property name="pubSubDomain" value="true"/>
> </bean>
> </property>
> </bean></sm:component>
> </sm:activationSpec>
>
> myComponent  snippet:
> -----------------------------------------------------
>
> QName service2 = new QName("http://servicemix.apache.org/services",
>                     "myJmsSender");
> exchange.setService(service2);
>
> exchange.setEndpoint(context.getEndpoint(service2, "myJmsSender"));
> channel.send(exchange);
>


-- 
Cheers,
Guillaume Nodet