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

View: New views
9 Messages — Rating Filter:   Alert me  

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

by Manupriya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Wayne Wundram :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...]
Sent: Thursday, August 14, 2008 9:03 AM
To: user@...
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



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

by Manupriya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


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 Threaded | Show Only this Message


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



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

by Manupriya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Pawan,

I tried the modifications suggested by you. But I am getting the following exception -

org.mule.api.transport.DispatchException: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=tcp://localhost:61616, connector=TcpConnector{this=105eb6f, started=true, initialised=true, name='connector.tcp.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[tcp], serviceOverrides=null}, transformer=[], name='endpoint.tcp.localhost.61616', properties={}, transactionConfig=Transaction{factory=null, action=NEVER, timeout=0}, filter=null, deleteUnacceptedMessages=false, securityFilter=null, synchronous=true, initialState=started, remoteSync=true, remoteSyncTimeout=10000, endpointEncoding=UTF-8}. Message payload is of type: String
        at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:188)
        at org.mule.transport.AbstractConnector.send(AbstractConnector.java:1890)
        at org.mule.endpoint.DefaultOutboundEndpoint.send(DefaultOutboundEndpoint.java:76)
        at org.mule.module.client.RemoteDispatcher.requestWireFormat(RemoteDispatcher.java:111)
        at org.mule.module.client.RemoteDispatcher.<init>(RemoteDispatcher.java:105)
        at org.mule.module.client.MuleClient.getRemoteDispatcher(MuleClient.java:990)
        at com.novus.generator.MessageGenerator.populateMesasgeQueueWithMuleClient(MessageGenerator.java:108)
        at com.novus.generator.MessageGenerator.main(MessageGenerator.java:102)
Caused by: java.io.IOException: An error occurred while verifying your connection.  You may not be using a consistent protocol on your TCP transport. Please read the documentation for the TCP transport, paying particular attention to the protocol parameter.
        at org.mule.transport.tcp.protocols.SafeProtocol.helpUser(SafeProtocol.java:110)
        at org.mule.transport.tcp.protocols.SafeProtocol.assertSiblingSafe(SafeProtocol.java:83)
        at org.mule.transport.tcp.protocols.SafeProtocol.read(SafeProtocol.java:37)
        at org.mule.transport.tcp.TcpMessageDispatcher.receiveFromSocket(TcpMessageDispatcher.java:150)
        at org.mule.transport.tcp.TcpMessageDispatcher.doSend(TcpMessageDispatcher.java:66)
        at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:157)
        ... 7 more
Caused by: java.io.IOException: Length 217 exceeds limit: 26
        at org.mule.transport.tcp.protocols.LengthProtocol.read(LengthProtocol.java:75)
        at org.mule.transport.tcp.protocols.SafeProtocol.assertSiblingSafe(SafeProtocol.java:79)
        ... 11 more

Can you please help me by pointing out what I am missing out?

Thanks,
Manupriya



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


Manupriya wrote:
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


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

by Vineet Khilani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you must use MuleClient, then you can try this:

public void sendMessage(Object msg){
        Map props = new HashMap();
        props.put("Sender", "Mule Client");
        MuleClient muleClient = new MuleClient();
        muleClient.dispatch("jms://localhost:61616/topic:manu.topic", msg, props);
}
The only problem with this is that your Java class needs to have the information about Active MQ, topic name, etc.

But if you want to send a message through Mule but don't have to use MuleClient, I would recommend this approach to remove all transport specific information from your Java client:

Add this to your mule config:
<jms:activemq-connector name="JMSConnector" connectionFactory-ref="activeMqConnectionFactory">
<spring:beans>
  <spring:bean name="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <spring:property name="brokerURL" value="tcp://localhost:61616"/>
  </spring:bean>
</spring:beans>
</jms:activemq-connector>
<service name="TopicService">
        <outbound>
            <outbound-pass-through-router>
                 <jms:outbound-endpoint queue="topic:manu.topic" transformer-refs="ObjectToJMSTransformer" />
            </outbound-pass-through-router>
        </outbound>
</service>


And in your Java class, you can send your message using the service name "TopicService":

Service service = MuleServer.getMuleContext().getRegistry().lookupService("TopicService");




Manupriya wrote:
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

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

by Manupriya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

My requirement is to have a java class that creates and puts JMS messages to an ActiveMQ topic.
At present I am using JNDI lookup for the topic and then I am creating a JMX producer for this topic. After this I create a JMS message and putting it on the topic.

I read through some of the articles on net that I can use Mule Client for achieving the same. I am quite new to Mule, Can you please suggest which would be a better design approach - using JMS producer or Mule Client?

Thanks,
Manu



If you must use MuleClient, then you can try this:

public void sendMessage(Object msg){
        Map props = new HashMap();
        props.put("Sender", "Mule Client");
        MuleClient muleClient = new MuleClient();
        muleClient.dispatch("jms://localhost:61616/topic:manu.topic", msg, props);
}
The only problem with this is that your Java class needs to have the information about Active MQ, topic name, etc.

But if you want to send a message through Mule but don't have to use MuleClient, I would recommend this approach to remove all transport specific information from your Java client:

Add this to your mule config:
<jms:activemq-connector name="JMSConnector" connectionFactory-ref="activeMqConnectionFactory">
<spring:beans>
  <spring:bean name="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <spring:property name="brokerURL" value="tcp://localhost:61616"/>
  </spring:bean>
</spring:beans>
</jms:activemq-connector>
<service name="TopicService">
        <outbound>
            <outbound-pass-through-router>
                 <jms:outbound-endpoint queue="topic:manu.topic" transformer-refs="ObjectToJMSTransformer" />
            </outbound-pass-through-router>
        </outbound>
</service>


And in your Java class, you can send your message using the service name "TopicService":

Service service = MuleServer.getMuleContext().getRegistry().lookupService("TopicService");




Manupriya wrote:
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


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

by antoine.borg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The cleanest way to do it would be:

1) Create a Java class that creates the message you want to send. This
message should be returned as the return value of a method.
2) Configure a service in Mule that uses your Java class as the component
and sends the message to a JMS queue or topic using the outbound router.

This is one of the key advantages of Mule - you do not need to code routing
mechanisms into your classes but can (indeed should) leave it up to Mule.

Cheers


Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
email: antoine.borg@... | blog: blog.ricston.com | web: ricston.com

-----Original Message-----
From: Manupriya [mailto:manupriya.sinha@...]
Sent: Friday, August 29, 2008 8:20 AM
To: user@...
Subject: Re: [mule-user] Want to write a standalone java class that uses
MuleClient for sending messages to ActiveMQ


Hi,

My requirement is to have a java class that creates and puts JMS messages to
an ActiveMQ topic.
At present I am using JNDI lookup for the topic and then I am creating a JMX
producer for this topic. After this I create a JMS message and putting it on
the topic.

I read through some of the articles on net that I can use Mule Client for
achieving the same. I am quite new to Mule, Can you please suggest which
would be a better design approach - using JMS producer or Mule Client?

Thanks,
Manu



Vineet Khilani wrote:

>
> If you must use MuleClient, then you can try this:
>
> public void sendMessage(Object msg){
> Map props = new HashMap();
> props.put("Sender", "Mule Client");
> MuleClient muleClient = new MuleClient();
> muleClient.dispatch("jms://localhost:61616/topic:manu.topic", msg,
> props); } The only problem with this is that your Java class needs to
> have the information about Active MQ, topic name, etc.
>
> But if you want to send a message through Mule but don't have to use
> MuleClient, I would recommend this approach to remove all transport
> specific information from your Java client:
>
> Add this to your mule config:
> <jms:activemq-connector name="JMSConnector"
> connectionFactory-ref="activeMqConnectionFactory">
> <spring:beans>
>   <spring:bean name="activeMqConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <spring:property name="brokerURL" value="tcp://localhost:61616"/>
>   </spring:bean>
> </spring:beans>
> </jms:activemq-connector>
> <service name="TopicService">
> <outbound>
>    <outbound-pass-through-router>
> <jms:outbound-endpoint queue="topic:manu.topic"
> transformer-refs="ObjectToJMSTransformer" />
>    </outbound-pass-through-router>
> </outbound>
> </service>
>
>
> And in your Java class, you can send your message using the service
> name
> "TopicService":
>
> Service service =
> MuleServer.getMuleContext().getRegistry().lookupService("TopicService"
> );
>
>
>
>
>
> Manupriya wrote:
>>
>> 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-MuleCl
ient-for-sending-messages-to-ActiveMQ-tp18976660p19214301.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



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

by Manupriya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Antoine,

Thanks for your suggestion. Actually I also want to use Mule to its fullest in routing. Let me see if I could use the approach suggested for my requirement.

Thanks,
Manu


antoine.borg wrote:
Hi,

The cleanest way to do it would be:

1) Create a Java class that creates the message you want to send. This
message should be returned as the return value of a method.
2) Configure a service in Mule that uses your Java class as the component
and sends the message to a JMS queue or topic using the outbound router.

This is one of the key advantages of Mule - you do not need to code routing
mechanisms into your classes but can (indeed should) leave it up to Mule.

Cheers


Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
email: antoine.borg@ricston.com | blog: blog.ricston.com | web: ricston.com

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


Hi,

My requirement is to have a java class that creates and puts JMS messages to
an ActiveMQ topic.
At present I am using JNDI lookup for the topic and then I am creating a JMX
producer for this topic. After this I create a JMS message and putting it on
the topic.

I read through some of the articles on net that I can use Mule Client for
achieving the same. I am quite new to Mule, Can you please suggest which
would be a better design approach - using JMS producer or Mule Client?

Thanks,
Manu



Vineet Khilani wrote:
>
> If you must use MuleClient, then you can try this:
>
> public void sendMessage(Object msg){
> Map props = new HashMap();
> props.put("Sender", "Mule Client");
> MuleClient muleClient = new MuleClient();
> muleClient.dispatch("jms://localhost:61616/topic:manu.topic", msg,
> props); } The only problem with this is that your Java class needs to
> have the information about Active MQ, topic name, etc.
>
> But if you want to send a message through Mule but don't have to use
> MuleClient, I would recommend this approach to remove all transport
> specific information from your Java client:
>
> Add this to your mule config:
> <jms:activemq-connector name="JMSConnector"
> connectionFactory-ref="activeMqConnectionFactory">
> <spring:beans>
>   <spring:bean name="activeMqConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <spring:property name="brokerURL" value="tcp://localhost:61616"/>
>   </spring:bean>
> </spring:beans>
> </jms:activemq-connector>
> <service name="TopicService">
> <outbound>
>    <outbound-pass-through-router>
> <jms:outbound-endpoint queue="topic:manu.topic"
> transformer-refs="ObjectToJMSTransformer" />
>    </outbound-pass-through-router>
> </outbound>
> </service>
>
>
> And in your Java class, you can send your message using the service
> name
> "TopicService":
>
> Service service =
> MuleServer.getMuleContext().getRegistry().lookupService("TopicService"
> );
>
>
>
>
>
> Manupriya wrote:
>>
>> 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-MuleCl
ient-for-sending-messages-to-ActiveMQ-tp18976660p19214301.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