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/30 09:28:53 UTC
Re: Put XML msgs from Java POJO into already running ActiveMQ
instance? Camel sample adjustment
> 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>.
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