On Mon, Aug 31, 2009 at 3:00 PM, Markus Mueller<[email protected]> wrote:
>
> Unfortunately, I can't see how to do it in the
> from A -> send to B
> from B -> send to C
> way.
>
> My problem is, that the IN_BETWEEN_QUEUE is dynamic and depends on the
> message. So my (a bit more more complex) configure looks like this :
>
> from("activemq:queue:IN_QUEUE").process(new Processor() {
>
> public void process(Exchange exchange) throws
> Exception {
>
> Message inMessage = exchange.getIn();
> String routingInfo =
> exchange.getIn().getBody().toString().substring(0,8);
> String targetSystem =
> TargetResolver.getInstance().getSpecificRoute(routingInfo );
> Endpoint ep =
> getContext().getEndpoint("activemq:queue:" +
> targetSystem);
> ProducerTemplate pt =
> getContext().createProducerTemplate();
> pt.send(ep, exchange);
> }
>
> });//.to("bean:resultBean");
>
> My Problem is, that I don't know the real name of my IN_BETWEEN_QUEUE
> outside my process(...). So if it doesn't work in the
> from A -> send to B -> send to C
> manner, I'll have to find another solution. But don't know how to right now.
>
Why do you want to send to a queue and then immediately retrieve it
from the same queue?
Well what you do in the processor code is to use the consumer template
to retrieve the "new message" on the queue.
ConsumerTemplate ct =
getContext().createConsumerTemplate();
Exchange consumed = ct.receive(ep);
Take a look at polling consumer EIP:
http://camel.apache.org/polling-consumer.html
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Mon, Aug 31, 2009 at 2:15 PM, Markus Mueller<[email protected]> wrote:
>>>
>>> I'm using camel 1.6 with servicemix 3.4.
>>>
>>> I've a simple route like this :
>>> from("activemq:queue:IN_QUEUE").to("activemq:queue:IN_BETWEEN_QUEUE").to("bean:resultBean");
>>>
>>> So if I send a message to my IN_QUEUE it's routed to my IN_BETWEEN_QUEUE
>>> and
>>> also reaches my resultBean. That's what I excpected. The Problem is,
>>> although the message is processed in my resultBean (without Exception) it
>>> is
>>> still in my IN_BETWEEN_QUEUE after all.
>>>
>>> If I delete the IN_BETWEEN_QUEUE and my route is like this :
>>> from("activemq:queue:IN_QUEUE").to("bean:resultBean");
>>> all is fine. The message is processed in my resultBean and after that
>>> correctly disappears from my IN_QUEUE.
>>>
>>> I can't understand that. Can anyone help ?
>>
>> Yeah what you are doing is like this
>> from A -> send to B -> send to C
>>
>> What you want to do is
>> from A -> send to B
>> from B -> send to C
>>
>>
>> And thus you should use 2 routes
>>
>> from("activemq:queue:IN_QUEUE").to("activemq:queue:IN_BETWEEN_QUEUE");
>>
>> from("activemq:queue:IN_BETWEEN_QUEUE").to("bean:resultBean");
>>
>>
>>
>>
>>> Markus
>>> --
>>> View this message in context:
>>> http://www.nabble.com/camel-routing---messages-stay-in-queue-tp25222552p25222552.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/camel-routing---messages-stay-in-queue-tp25222552p25223111.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus