Clients Exenchange of Messages Independently
Hello Friends, I have queries about publisher(mule client1) & consumer(mule client2) synchronization. I am using Mule2.
I am running mule server & all my clients communicatng using remoteDispatcher. Setup is working fine.
Publisher(muleclient1) is publishing data on JMS (ActiveMQ) using dispatcher.dispatchRemote.
consumer (muleClient2) is receiving data on JMS (ActiveMQ) using dispatcher.receiveRemote.
publisher, consumer & mule server all are working fine.
My problem is when i stop my publisher(muleclient1) & restart it again i dont receive any message at running consumer(muleclient2).
If i want to receive messages then i also have to restart my consumer.
I want consumer & publisher to run independently & they should send & receive messages as an when they comes up.
If one goes down, there should not be dependency to restart other.
Here is my Mule-Config.xml
<client:remote-dispatcher-agent>
<client:remote-endpoint address="tcp://localhost:60504"
synchronous="true" />
</client:remote-dispatcher-agent>
<vm:connector name="asyncVm" queueEvents="true" />
<jms:activemq-connector name="jmsConnector"
brokerURL="tcp://localhost:61616" specification="1.1" />
<endpoint name="jmsCaafConfiguration"
address="jms://topic:caaf.configuration" />
<model name="EventBridge">
<service name="publisherUMO">
<inbound>
<vm:inbound-endpoint path="publisherVM" />
</inbound>
<bridge-component />
<outbound>
<multicasting-router>
<outbound-endpoint ref="jmsCaafConfiguration" />
<!-- <stdio:outbound-endpoint system="OUT"/>-->
</multicasting-router>
</outbound>
</service>
<service name="caafConfiguration">
<inbound>
<inbound-endpoint ref="jmsCaafConfiguration"/>
</inbound>
<bridge-component />
<outbound>
<outbound-pass-through-router>
<vm:outbound-endpoint path="vmCaafConfiguration"/>
</outbound-pass-through-router>
</outbound>
</service>
</model>
</mule>
Here is my publisher(muleclient1) code
public static void main(String args[])
{
MuleClient client = new MuleClient();
RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:60504");
int i = 1;
while (true)
{
dispatcher.dispatchRemote("vm://publisherVM", i + " give me the price of XXX", null);
i++;
Thread.sleep(1000);
}
}
Here is my consumer(muleClient2) code
public static void main(String args[]) throws Exception
{
MuleClient client = new MuleClient();
RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:60504");
MuleMessage muleMessage = null;
while (true)
{
muleMessage = dispatcher.receiveRemote("vm://vmCaafConfiguration", 0);
System.out.println("Received " + muleMessage.getPayloadAsString());
Thread.sleep(1000);
}
return exitCode;
}
I want consumer & publisher to run independently & they should send & receive messages as an when they comes up.
If one goes down, there should not be dependency to restart other.
Please let me know how can i acheive this. Is it possible in MULE2?
thanks & regards,
Jack