I think you have a timing issue. The remove client uses an ActiveMQ embedded broker with multicast discovery. In effects, it creates a simple JBI container which is clustered with the main container. The problem is that when you init/start the remote client, the call does not block until the container is discovered. Try putting a sleep() after the jbi.start() call. Could you raise a JIRA issue and will add a blocking (with timeout) start method.
The remote client is quite heavyweight so you should not create/destroy it each time you need it. Cheers, Guillaume Nodet On 5/22/06, pgodot <[EMAIL PROTECTED]> wrote:
Hi Guillaume, I checked my code and do a simple test case. My SM is configure by service.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:sm="http://servicemix.apache.org/config/1.0" xmlns:eip="http://servicemix.apache.org/eip/1.0"> <sm:container id="jbi" flowName="jms" createMBeanServer="true" dumpStats="true" statsInterval="10" > <sm:activationSpecs> <sm:activationSpec componentName="myEip" service="test:myEip"> <sm:component> <eip:component> <eip:endpoints> <!-- <eip:static-routing-slip service="test:routingSlip" endpoint="endpoint"> <eip:targets> <eip:exchange-target service="test:echo" /> <eip:exchange-target service="test:trace1" /> </eip:targets> </eip:static-routing-slip> --> <!-- generate a javax.jbi.messaging.MessagingException: illegal exchange status: done on trace component --> <eip:wire-tap service="tem:tagAPIBC" endpoint="endpoint"> <eip:target> <eip:exchange-target service="test:echo" /> </eip:target> <eip:inListener> <eip:exchange-target service="test:trace" /> </eip:inListener> </eip:wire-tap> </eip:endpoints> </eip:component> </sm:component> </sm:activationSpec> <sm:activationSpec componentName="echo" service="test:echo"> <sm:component> <bean xmlns=" http://xbean.org/schemas/spring/1.0" class=" org.apache.servicemix.components.util.EchoComponent"> </bean> </sm:component> </sm:activationSpec> <sm:activationSpec componentName="trace" service="test:trace"> <sm:component> <bean xmlns=" http://xbean.org/schemas/spring/1.0" class=" org.apache.servicemix.components.util.TraceComponent"> </bean> </sm:component> </sm:activationSpec> </sm:activationSpecs> </sm:container> <!-- the work manager (thread pool) for this container --> <bean id="workManager" class="org.jencks.factory.WorkManagerFactoryBean"> <property name="threadPoolSize" value="30" /> </bean> </beans> Simple wiretap configuration. My java code is: public class SampleEIP { private static DefaultServiceMixClient jbi = null; public void initialize(){ try { jbi = new RemoteServiceMixClient(); ((RemoteServiceMixClient)jbi).init(); jbi.start(); } catch (JBIException e) { e.printStackTrace(); } } public static void main(String[] args) { SampleEIP test = new SampleEIP(); test.initialize(); test.send(); test.stop(); } private void stop() { try { jbi.stop(); } catch (JBIException e) { e.printStackTrace(); } } private void send() { // InOnly exchange = jbi.createInOnlyExchange(); try{ InOut exchange = jbi.createInOutExchange(); NormalizedMessage inMessage = exchange.getInMessage(); inMessage.setContent(new StringSource("<in>Message</in>")); QName service = new QName("tagAPIBC"); exchange.setService(service); boolean bRet=jbi.sendSync(exchange); if (bRet = true){ NormalizedMessage recieved= exchange.getMessage("out"); //InOut recieved = (InOut) jbi.receive (1000); if (recieved!=null){ System.out.println(" Throw a done message"); jbi.done(exchange); }else{ System.out.println("recieved is null"); } }else { System.out.println("sendSync is false"); } }catch(Exception e){ e.printStackTrace(); } } } My log file in debug level for the client: 15:31:16,493 INFO JMSFlow ServiceMix: Starting jms flow [main ] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:273) 15:31:16,633 INFO JMSFlow ServiceMix: adding remote endpoint: ServiceEndpoint[service=ofsml,endpoint=ofsmlTester] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:444) 15:31:16,649 INFO JMSFlow ServiceMix: adding remote endpoint: ServiceEndpoint[service=tagAPIBC,endpoint=endpoint] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:444) 15:31:16,649 INFO JMSFlow ServiceMix: adding remote endpoint: ServiceEndpoint[service=trace,endpoint=trace] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:444) 15:31:16,665 INFO JMSFlow ServiceMix: adding remote endpoint: ServiceEndpoint[service=echo,endpoint=echo] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:444) Role : Provider destinationId : null 15:31:22,493 DEBUG Broker Routing exchange [EMAIL PROTECTED] to: ServiceEndpoint[service=tagAPIBC,endpoint=endpoint] [main ] (org.apache.servicemix.jbi.nmr.Broker:389) Role : Provider destinationId : null endpoint :ServiceEndpoint[service=tagAPIBC,endpoint=endpoint] 15:31:22,493 DEBUG AbstractFlow Called Flow send [main ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:116) 15:31:22,946 DEBUG AbstractFlow Called Flow doRouting [Thread-7 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:165) 15:31:22,993 DEBUG AbstractFlow Called Flow doRouting For myEip Destination [container=ServiceMix,name=echo] role : ConsumerEndpoint ServiceEndpoint[service=echo,endpoint=echo]Source Id: [container=ServiceMix,name=myEip] [Thread-7 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:168) 15:31:22,993 ERROR JMSFlow$5 Caught an exception routing ExchangePacket: [Thread-7 ] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:536) javax.jbi.messaging.MessagingException: No component named myEip - Couldn't route MessageExchange [EMAIL PROTECTED] at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting( AbstractFlow.java:180) at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3( JMSFlow.java:1) at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run( JMSFlow.java:534) at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java :291) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run (Unknown Source) at java.lang.Thread.run(Thread.java:595) The server log : 15:48:17,711 INFO JMSFlow ServiceMix: Starting jms flow [main ] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:273) 15:48:17,758 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=ofsml,endpoint=ofsmlTester]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:17,805 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=tagAPIBC,endpoint=endpoint]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:17,821 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=trace,endpoint=trace]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:17,836 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=echo,endpoint=echo]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:24,368 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=ofsml,endpoint=ofsmlTester]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:24,383 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=tagAPIBC,endpoint=endpoint]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:24,383 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=trace,endpoint=trace]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:24,399 INFO JMSFlow ServiceMix: broadcasting info for org.apache.servicemix.jbi.event.EndpointEvent [source=ServiceEndpoint[service=echo,endpoint=echo]] [ssion Task] (org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow:388) 15:48:29,711 DEBUG AbstractFlow Called Flow doRouting [Thread-8 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:165) 15:48:29,711 DEBUG AbstractFlow Called Flow doRouting For myEip Destination [container=ServiceMix,name=myEip] role : ProviderEndpoint ServiceEndpoint[service=tagAPIBC,endpoint=endpoint]Source Id: [container=ServiceMix,name=ID:chdsk-pgodot-1501-1148305701258-0:0] [Thread-8 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:168) 15:48:29,727 DEBUG BaseLifeCycle Received exchange: status: Active, role: Provider [2-thread-2] (org.apache.servicemix.eip.EIPSpringComponent:363) 15:48:29,727 DEBUG MemoryStore Storing object with id: ID:chdsk-pgodot-1501-1148305701258-9:0 [2-thread-2] (org.apache.servicemix.store.memory.MemoryStore:50) Role : Provider destinationId : null 15:48:29,743 DEBUG Broker Routing exchange [EMAIL PROTECTED] to: ServiceEndpoint[service=trace,endpoint=trace] [2-thread-2] (org.apache.servicemix.jbi.nmr.Broker:389) Role : Provider destinationId : null endpoint :ServiceEndpoint[service=trace,endpoint=trace] 15:48:29,743 DEBUG AbstractFlow Called Flow send [2-thread-2] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:116) Role : Provider destinationId : null 15:48:29,758 DEBUG Broker Routing exchange [EMAIL PROTECTED] to: ServiceEndpoint[service=echo,endpoint=echo] [2-thread-2] (org.apache.servicemix.jbi.nmr.Broker:389) Role : Provider destinationId : null endpoint :ServiceEndpoint[service=echo,endpoint=echo] 15:48:29,774 DEBUG AbstractFlow Called Flow doRouting [Thread-9 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:165) 15:48:29,774 DEBUG AbstractFlow Called Flow doRouting For trace Destination [container=ServiceMix,name=trace] role : ProviderEndpoint ServiceEndpoint[service=trace,endpoint=trace]Source Id: [container=ServiceMix,name=myEip] [Thread-9 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:168) 15:48:29,774 DEBUG AbstractFlow Called Flow send [2-thread-2] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:116) 15:48:29,774 INFO TraceComponent Exchange: [EMAIL PROTECTED] received IN message: [EMAIL PROTECTED] : {}} [Thread-9 ] (org.apache.servicemix.components.util.TraceComponent:63) 15:48:29,774 INFO TraceComponent Body is: <in>Message</in> [Thread-9 ] (org.apache.servicemix.components.util.TraceComponent:65) Role : Consumer destinationId : [container=ServiceMix,name=trace] Role : Consumer destinationId : [container=ServiceMix,name=trace] endpoint :ServiceEndpoint[service=trace,endpoint=trace] 15:48:29,774 DEBUG AbstractFlow Called Flow send [Thread-9 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:116) 15:48:29,805 DEBUG AbstractFlow Called Flow doRouting [Thread-10 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:165) 15:48:29,805 DEBUG AbstractFlow Called Flow doRouting [Thread-11 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:165) 15:48:29,805 DEBUG AbstractFlow Called Flow doRouting For echo Destination [container=ServiceMix,name=echo] role : ProviderEndpoint ServiceEndpoint[service=echo,endpoint=echo]Source Id: [container=ServiceMix,name=myEip] [Thread-10 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:168) 15:48:29,805 DEBUG AbstractFlow Called Flow doRouting For myEip Destination [container=ServiceMix,name=trace] role : ConsumerEndpoint ServiceEndpoint[service=trace,endpoint=trace]Source Id: [container=ServiceMix,name=myEip] [Thread-11 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:168) 15:48:29,805 INFO EchoComponent Echoed back message: [EMAIL PROTECTED] : {}} [Thread-10 ] (org.apache.servicemix.components.util.EchoComponent:36) Role : Consumer destinationId : [container=ServiceMix,name=echo] Role : Consumer destinationId : [container=ServiceMix,name=echo] endpoint :ServiceEndpoint[service=echo,endpoint=echo] 15:48:29,821 DEBUG AbstractFlow Called Flow send [Thread-10 ] (org.apache.servicemix.jbi.nmr.flow.AbstractFlow:116) 15:48:29,821 DEBUG BaseLifeCycle Received exchange: status: Done, role: Consumer [2-thread-2] (org.apache.servicemix.eip.EIPSpringComponent:363) This test case works 1/5 times. :-( but the method stop on jbi object never stop JMS thread !!!! -- View this message in context: http://www.nabble.com/RemoteServiceMixClient+-+EIP+component+-+done+an+IOMEX-t1644809.html#a4505615 Sent from the ServiceMix - User forum at Nabble.com.
-- Cheers, Guillaume Nodet
