You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by benxs <bx...@yahoo.co.uk> on 2010/07/29 13:47:06 UTC

Put XML msgs from Java POJO into already running ActiveMQ instance? Camel sample adjustment

When I look into the shipped Camel example

http://camel.apache.org/pojo-messaging-example.html

then there is said that the XML message are put into an "an embedded
instance of Apache ActiveMQ".
Enbedded means embedded into Camel (example).

How can I put the same XML msgs instead into an already running, external
ActiveMQ instance?

Let say this Active MQ instance is listening for connections at

tcp://mycomp1:61616

How can I change the official Camel sample source so that XML msgs are
fetched analogue
from an external running ActiveMQ instance? 

Ben

-- 
View this message in context: http://camel.465427.n5.nabble.com/Put-XML-msgs-from-Java-POJO-into-already-running-ActiveMQ-instance-Camel-sample-adjustment-tp2256723p2256723.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Put XML msgs from Java POJO into already running ActiveMQ instance? Camel sample adjustment

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah you need to set the brokerURL on the activemq component.
For example in the spring XML file.

The @Produce only refers to the activemq component and the name of the
JMS destination to send the message to.


On Fri, Jul 30, 2010 at 9:28 AM, benxs <bx...@yahoo.co.uk> wrote:
>
>> You change the brokerURL
>
> How do I do this in java POJOs with annotations?
>
> I think in pure java coding would be:
>
> import org.apache.activemq.ActiveMQConnectionFactory;
> ...
>  CamelContext context = new DefaultCamelContext();
>  ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("tcp://localhost:51616");
>  context.addComponent("test-jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>
> But how do I do this with annotations?
> Is there an annotation similar to:  @BrokerURL("tcp://localhost:51616");
>
> Where do I have to put this statement into the following code?
>
>
> import org.apache.camel.Consume;
> import org.apache.camel.Produce;
> import org.apache.camel.ProducerTemplate;
>
> //START SNIPPET: ex
> public class SendFileRecordsToQueueBean {
>    @Produce(uri = "activemq:personnel.records")
>    ProducerTemplate producer;
>
>    @Consume(uri = "file:src/data?noop=true")
>    public void onFileSendToQueue(String body) {
>        producer.sendBody(body);
>    }
> }
>
> Ben
> --
> View this message in context: http://camel.465427.n5.nabble.com/Put-XML-msgs-from-Java-POJO-into-already-running-ActiveMQ-instance-Camel-sample-adjustment-tp2256723p2259241.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Put XML msgs from Java POJO into already running ActiveMQ instance? Camel sample adjustment

Posted by benxs <bx...@yahoo.co.uk>.
> You change the brokerURL 

How do I do this in java POJOs with annotations?

I think in pure java coding would be:

import org.apache.activemq.ActiveMQConnectionFactory;
...
  CamelContext context = new DefaultCamelContext();
  ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://localhost:51616");
  context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

But how do I do this with annotations?
Is there an annotation similar to:  @BrokerURL("tcp://localhost:51616");

Where do I have to put this statement into the following code?


import org.apache.camel.Consume;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;

//START SNIPPET: ex
public class SendFileRecordsToQueueBean {
    @Produce(uri = "activemq:personnel.records")
    ProducerTemplate producer;

    @Consume(uri = "file:src/data?noop=true")
    public void onFileSendToQueue(String body) {
        producer.sendBody(body);
    }
}

Ben
-- 
View this message in context: http://camel.465427.n5.nabble.com/Put-XML-msgs-from-Java-POJO-into-already-running-ActiveMQ-instance-Camel-sample-adjustment-tp2256723p2259241.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Put XML msgs from Java POJO into already running ActiveMQ instance? Camel sample adjustment

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 29, 2010 at 1:47 PM, benxs <bx...@yahoo.co.uk> wrote:
>
> When I look into the shipped Camel example
>
> http://camel.apache.org/pojo-messaging-example.html
>
> then there is said that the XML message are put into an "an embedded
> instance of Apache ActiveMQ".
> Enbedded means embedded into Camel (example).
>
> How can I put the same XML msgs instead into an already running, external
> ActiveMQ instance?
>
> Let say this Active MQ instance is listening for connections at
>
> tcp://mycomp1:61616
>
> How can I change the official Camel sample source so that XML msgs are
> fetched analogue
> from an external running ActiveMQ instance?
>

You change the brokerURL

> Ben
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Put-XML-msgs-from-Java-POJO-into-already-running-ActiveMQ-instance-Camel-sample-adjustment-tp2256723p2256723.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus