« Return to Thread: Want to write a standalone java class that uses MuleClient for sending messages to ActiveMQ

RE: Want to write a standalone java class that uses MuleClient for sending messages to ActiveMQ

by PawanModi :: Rate this Message:

Reply to Author | View in Thread


Hello Manupriya,

I read your query. You can use mule client to send jms messages on particular topic. I did minor change in your code. I am using VM connector to send your message to Mule component (samplejms) defined in config file & later its outbound endpoint (jms) will dispatch your message on topic defined at jms endpoint using ActiveMQ Broker.  

Modified code:

        try {
               MuleClient client = new MuleClient();

                RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:61616");
               
                 for (String rowValue : rowList) {
                         dispatcher.sendAsyncRemote("vm://manu.vm", rowValue, null);
                 }
                } catch (MuleException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }



Now your mule config will look like. Use the following config along with your existing configuration.

<vm:connector name="asyncVm" queueEvents="true" />

<endpoint name="samplejmsmessage"
                address="jms://topic:manu.topic" synchronous="false" connector-ref="jmsConnector"/>

 <service name="SampleJMS">
                        <inbound>
                                <vm:inbound-endpoint path="manu.vm" connector-ref="asyncVm" />
                        </inbound>
                        <bridge-component />
                        <outbound>
                                <multicasting-router>
                                        <outbound-endpoint ref="samplejmsmessage" />
                                </multicasting-router>
                        </outbound>
 </service>



I hope i answered your question.

Cheer,
Pawan Modi



Thanks Wayne,

I am currently using JMS messages only to create and put the messages in the Active MQ topic. But I wanted to try MuleClient for this. Can you please let me know in which scenarios should we use MuleClient?

Thanks,
Manupriya


Wayne Wundram wrote:
Dear Manupriya,

Why don't you just use JMS? Why the need for MuleClient?

Regards,
Wayne Wundram
www.miraculum.com
Johannesburg, South Africa

-----Original Message-----
From: Manupriya [mailto:manupriya.sinha@gmail.com]
Sent: Thursday, August 14, 2008 9:03 AM
To: user@mule.codehaus.org
Subject: [mule-user] Want to write a standalone java class that uses
MuleClient for sending messages to ActiveMQ


Hi,

My requirement is to have a standalone java class that just generates
messages and puts them to an Active MQ Topic. I want to write something
similar to following -

        try {
               MuleClient client = new MuleClient();

                RemoteDispatcher dispatcher =
client.getRemoteDispatcher("tcp://localhost:61616");
               
                 for (String rowValue : rowList) {
       
dispatcher.sendAsyncRemote("jms://topic:manu.topic", rowValue, null);
                 }
                } catch (MuleException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }

Can you please help?

Thanks,
Manupriya
--
View this message in context:
http://www.nabble.com/Want-to-write-a-standalone-java-class-that-uses-Mu
leClient-for-sending-messages-to-ActiveMQ-tp18976660p18976660.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Want to write a standalone java class that uses MuleClient for sending messages to ActiveMQ