Hi,

I have the following error that I need to resolve:

Exception in thread "main" javax.jbi.messaging.MessagingException: Could not
find route for exchange: InOnly[
  id: ID:172.22.16.177-11a77be0ea4-3:0
  status: Active
  role: provider
  service: {urn:test}service
  in: <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
] for service: {urn:test}service and interface: null
        at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
        at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431)
        at
org.apache.servicemix.client.DefaultServiceMixClient.send(DefaultServiceMixClient.java:147)
        at PojoSender.sendMessage(PojoSender.java:41)
        at PojoSender.main(PojoSender.java:50)

Now, I don't necessarily need to use the RemoteServiceMixClient (I don't
need JMS) but I just want to send a simple message to my servicemix-bean SU
component that is currently running and have it receive it.  I tried using
the DefaultServiceMixClient but I couldn't find a way to pass (or get) an
instance of the JBIContainer.  My client code will eventually be in a Web
application and not running inside the container, it will be on a separate
server.

OK, so here is my client code:

public class PojoSender {
        
    private RemoteServiceMixClient client = new
RemoteServiceMixClient("tcp://localhost:61616");;
    
    public void sendMessage() throws MessagingException, Exception{
    
        client.init();
        client.start();
        
        InOnly exchange = client.createInOnlyExchange();

        NormalizedMessage message = exchange.getInMessage();
        message.setProperty("name", "Andrew");
        message.setContent(new StreamSource(new
StringReader("<hello>world</hello>")));

        // lets use a specific service to dispatch to
        QName service = new QName("urn:test","service");
        exchange.setService(service);
        client.send(exchange);
    }
    
      
    public static void main(String [ ] args) throws Exception
    {
        new PojoSender().sendMessage();
    }
}

and here is my servicemix-bean SU code:

import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;

public class MyBean implements MessageExchangeListener {

    @Resource
    private DeliveryChannel channel;

    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        System.out.println("Received exchange: " + exchange);
        exchange.setStatus(ExchangeStatus.DONE);
        channel.send(exchange);
    }

}


and here is my xbeans.xml:


<beans xmlns:bean="http://servicemix.apache.org/bean/1.0";>

  <bean:endpoint service="test:service" endpoint="endpoint" bean="#myBean"/>

  <bean id="myBean" class="esb.binding.MyBean"/>

</beans>


If somebody can help I would really appreciate this as I really have to
deliver something  in a few days time.

Thanks...

-- 
View this message in context: 
http://www.nabble.com/Help%21-Could-not-find-route-for-exchange%3A-InOnly-%28RemoteServiceMixClient%29-tp17777529p17777529.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to