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: "Trash bin" endpoint?
Date Sat, 27 Jun 2009 06:41:47 GMT
Hi

Its not to bad with a "null" component to send it to dev null. Named
trashbin or devnull or whatever is a good name.

You can do this in camel 2.0

to("direct:trash")

from("direct:trash").stop();

It requires however that 2nd route to read from it otherwise you get
WARN logs about no consumer to read from it.


On Sat, Jun 27, 2009 at 5:27 AM, Hadrian Zbarcea<hzbarcea@gmail.com> wrote:
> The short answer:
>
>> 1) Does it make sense?
>
> Yes, kinda.
>
>> 2) Is there a means to do it in Camel? If so: Which version?
>
> Yes, absolutely.
>
>> 3) If there are multiple ways to do it, what would be the most "elegant"
>> one, the "best practice"?
>
> Whatever fits you.  I don't think there is a best practice for such case.
>  An easy way to achieve this is:
> from(start).choice().when(condition).process(anythingyouwant).otherwise().to("file:trash-bin");
> Where trash-bin is a directory on your file system.
>
> This feature exists in camel from the beginning.
>
> In the case of a choice() for instance there is the otherwise() path for
> messages that do not meet any of your criteria defined by when().  As far as
> persistence of such messages goes, it is up to you to decide where to keep
> them until you decide what to do with them, and for that you have seda:
> queues or you could use more robust jms: queues or you could use a file: or
> ftp: filesystem or even smtp: mail servers.  You can retrieve your messages
> from there later.  So there is no trash bin per se, but you can create your
> own, whenever and however you like.
>
> I hope this helps.
> Hadrian
>
>
> On Jun 26, 2009, at 5:39 PM, Marek2009 wrote:
>
>>
>> Hello,
>>
>> I would like to achieve this in a route: Discarding a message based on a
>> specific criteria.
>>
>> I know: This is what Message Filter pattern and the .filter() clause do,
>> but
>> I would rather use .choice()-.when() followed by something like
>> ".to('trashbin:trashbin-endpoint')". This approach ("filtering by content
>> routing") appears to have the following advantage: If I later decide to
>> actually _use_ these messages instead of discarding them, I do not have to
>> modify any predicates or re-arrange filter clauses, I just have to touch
>> one
>> single ".to()" clause.
>>
>> My question: Is there a "trash bin" component/endpoint in Camel?
>>
>> I tried to use a "dead end" direct endpoint for this purpose, i. e. a
>> direct
>> endpoint associated with no ".from()" clause whatsover. But I am not sure,
>> if this has any side effects. The message just should get discarded
>> without
>> any redelivery attempts, errors or warnings, the exchange should be
>> considered completed. This should also work for InOut exchanges.
>>
>> 1) Does it make sense?
>> 2) Is there a means to do it in Camel? If so: Which version?
>> 3) If there are multiple ways to do it, what would be the most "elegant"
>> one, the "best practice"?
>>
>> Any feedback will be greatly appreciated. :-)
>>
>> Kind Regards
>>
>> Marek
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%22Trash-bin%22-endpoint--tp24227620p24227620.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

Mime
View raw message