camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" <claus.ib...@gmail.com>
Subject Re: Using the correlation id in regular routes
Date Fri, 19 Dec 2008 09:33:57 GMT
On Fri, Dec 19, 2008 at 10:29 AM, Ryadh Amar <magnetic.ganesh@gmail.com> wrote:
>
> Thanks Claus and Ramon,
> I managed to combine both routes and used an aggregate, which helped a lot
> my use case.
> I've seen a couple of threads where proposals were made to find a way to
> persist messages, something like BAM, since this is a requirement, I am
> going down this route (no pun intended ;) )
>
> from("file:src/data/recieved?noop=true").to("ibatis:setMessageReceived");
> from("file:src/data/processed?noop=true").to("ibatis:setMessageProcessed");
> from("file:src/data/error?noop=true").to("ibatis:setMessageFailure");
> from("file:src/data/done?noop=true").to("ibatis:setMessageSuccess");
>
> And then have another route, which will simply poll the table where the
> messages are stored and show the status of each one, something like:
>
> from("jetty:http://localhost:8080/myapp/myservice").process(new
> MessagesStatusService());
> where MessagesStatusService() pulls the list of messages from the table and
> displays the status of each one.
>
> Thoughts?
Thats a good solution. Storing the status in a DB then its persistent.

Note that noop=true on the file consumer will not delete/move the
file, so the folder will just grow larger and larger.
But I guess that is for unit testing?

We use noop=true as an essential part of unit testing Camel itself.
Then we can have file messages we can route, where we can store the
files in SVN.


>
> Thanks in advance for you efforts, Camel has now become an essential part of
> my toolset.
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> You can combine two routes into a single route path using internal seda
>> queues
>>
>> from("file://foo").to(seda:todo)
>> from("file://bar").to(seda:todo)
>>
>> from(seda:todo)...aggreagete using the header
>>
>>
>>
>> On Mon, Dec 15, 2008 at 11:51 AM, Ryadh Amar <magnetic.ganesh@gmail.com>
>> wrote:
>>>
>>> Hi Ramon,
>>> Thanks for your input, I've already tried that, but I don't think that
>>> the
>>> aggregator pattern applies here, it's more of a request-reply issue,
>>> correct
>>> me if I am wrong, but I think that aggregation applies to only one route,
>>> not the whole camel context, if I understand correctly your suggestion, I
>>> need to apply the aggregator on 2 different routes, this wouldn't work
>>> because there is no way for the camel context to know that I am working
>>> on
>>> the "same" message (albeit without the file extension), that is why I
>>> believe that BAM may provide some hints.
>>> Thanks for your answers.
>>> Ryadh.
>>>
>>> Ramon Buckland wrote:
>>>>
>>>> Hi Amar,
>>>>
>>>> I have not used the Aggregator in Camel so please bear with me. You will
>>>> need to test this all.
>>>>
>>>> It seems to me that the aggregator would need to know (as you have
>>>> suggested) which "value" is to be your correlation Id.
>>>>
>>>> Have you tried running the messages through a "<setHeader
>>>> headerName="MyAppCorrelationId"><simple>${file:name.noext}</simple></setHeader>"
>>>>
>>>> And then in the aggregator, you need to tell it that this is the header
>>>> name, to use as the correlation Id.
>>>>
>>>> eg:
>>>>
>>>> <aggregate>
>>>>    <header>MyAppCorrelationId</header>
>>>>    ....
>>>>
>>>> Looking at the wiki documentation for the aggregator (
>>>> http://activemq.apache.org/camel/aggregator.html) suggests this may
>>>> work.
>>>>
>>>> Hope that helps.
>>>>
>>>> I have the following setup:
>>>>> a route which ends up moving files to directory input/
>>>>> another one which polls the done/ and errors/ directories
>>>>> Now, an external applications takes files from the input processes them
>>>>> and
>>>>> sends the result to the done/ directory and the errors to the errors/
>>>>> directory
>>>>> There is a common pattern in the file naming strategy:
>>>>> input: 123456.xml
>>>>> errors: 123456.log
>>>>> done: 123456.log
>>>>> ${file:name.noext} seems to be a good candidate for a correlation
>>>>> identifier
>>>>> But I can't get how I can use the identifier in the configuration of
>>>>> the
>>>>> routes
>>>>> I was looking for a correlate method for the route configuration dsl,
>>>>> but
>>>>> it
>>>>> doesn't seem to be available,
>>>>> and I gave a shot at BAM, which is realy helpful for time based checks,
>>>>> but
>>>>> doesn't seem to give me the possiblity to route messages(apart from
>>>>> failures)
>>>>>
>>>>> There is obviously a way to do this using processors, and filters
>>>>> etc...
>>>>> but
>>>>> I think that this could be achieved in a much simpler fashion.
>>>>>
>>>>> Thank you in advance for your replies,
>>>>> Ryadh.
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Using-the-correlation-id-in-regular-routes-tp20978464s22882p20978464.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Using-the-correlation-id-in-regular-routes-tp20978464s22882p21011727.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Using-the-correlation-id-in-regular-routes-tp20978464s22882p21088259.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Mime
View raw message