You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "helmut.at.work" <he...@gmail.com> on 2012/12/04 21:07:50 UTC

How to get RouteId in a GenericFileFilter ...

I can't get a solution for a dynamic file filter which filters files before
consuming based on additional infos I have bound to the route (RouteId).
I tried 
- GenricFileFilter
- GenericFileProcessStrategy
- PollingConsumerPollStrategy
but I can't see a way to get a join to the origin route.

What do I miss? 

Thank you. 
Your help would be greatly appreciated. 

Best Regards Helmut



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get RouteId in a GenericFileFilter ...

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 6, 2012 at 8:46 AM, helmut.at.work <he...@gmail.com> wrote:
> As explained in the thread above, I need a correlation to the route in the
> GenericFileFilter.
> You show me the way to set a property in the  GenericFileFilter class with
> spring.
> For Java DSL I set this property with help of the constructor of the
> GenericFileFilter class.
> The question is: Is there a better way to set the property in the
> GenericFileFilter class with Java DSL?
>

Its Java so you got a zillion ways of doing that. Setting as a
constructor is a good way, because that's how objects gets
initialized.
You can of course leave getter/setters there as well, and use a
setter. Then its similar to Spring XML does it when you use
<bean><property ></bean> style.

And it would be overkill to introduce a Java IoC framework. And I
think even Spring can do this now; though 98%+ (or great majority
IMHO) uses the XML approach.



> Thank you,
> Helmut
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723694.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: How to get RouteId in a GenericFileFilter ...

Posted by "helmut.at.work" <he...@gmail.com>.
As explained in the thread above, I need a correlation to the route in the
GenericFileFilter.
You show me the way to set a property in the  GenericFileFilter class with
spring.
For Java DSL I set this property with help of the constructor of the
GenericFileFilter class.
The question is: Is there a better way to set the property in the
GenericFileFilter class with Java DSL?

Thank you,
Helmut




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723694.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get RouteId in a GenericFileFilter ...

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Dec 5, 2012 at 4:47 PM, helmut.at.work <he...@gmail.com> wrote:
> Sorry I'm a bit stupid today.
> Of course I can set the property with a constructor like this:
>
>
> Are there additional methods to set the properties?
>

What do you mean? Set properties on what?

> Regards Helmut
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723663.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: How to get RouteId in a GenericFileFilter ...

Posted by "helmut.at.work" <he...@gmail.com>.
Sorry I'm a bit stupid today.
Of course I can set the property with a constructor like this:

 
Are there additional methods to set the properties?

Regards Helmut



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723663.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get RouteId in a GenericFileFilter ...

Posted by "helmut.at.work" <he...@gmail.com>.
Thank you for your fast reply. It helps a lot. 
The solution to register a different filter for every route works for me.
I was able to code a little spring based example.
One thing is left: Can you give me a hint where to lock for the counterpart
of spring property

in Java DSL.

Register the filter bean with the corresponding bean is not a problem, but
how to set the property for that bean?

Thank you in advance
Helmut



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723661.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get RouteId in a GenericFileFilter ...

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

This is not supported; and its not easy doable as its an API breaking
to pass in any route information as a new parameter to the
interface(s).

You can create a generic filter and setup a number of filters with the
route id configured.

<bean id="filterA" class="com.MyFiler">
   <property name="routeId" value="routeA"/>
</bean>

<bean id="filterB" class="com.MyFiler">
   <property name="routeId" value="routeB"/>
</bean>




On Wed, Dec 5, 2012 at 8:42 AM, helmut.at.work <he...@gmail.com> wrote:
> Please excuse my poor description of the problem.
> Second try:
> In my application I would like to implement a filter for a file consumer,
> like that:
>
> I plan to code a general filter for all/some of my routes.
> In the filter method I do in the first run something like this:
>
> No problem so far.
> But now comes the point where I stuck.
> The filter should be quite dynamic and the list of file numbers depends of
> the route where the the consumer belongs to. Example:
>
> I can't find a correlation to the camel route at this point.
> I hope my problem is now a bit better explained.
> I also tried similar with the GenericFileProcessStrategy and
> PollingConsumerPollStrategy, but can't find a connection to the route.
>
> Regards Helmut
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723643.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: How to get RouteId in a GenericFileFilter ...

Posted by "helmut.at.work" <he...@gmail.com>.
Please excuse my poor description of the problem.
Second try:
In my application I would like to implement a filter for a file consumer,
like that:

I plan to code a general filter for all/some of my routes.
In the filter method I do in the first run something like this:

No problem so far. 
But now comes the point where I stuck.
The filter should be quite dynamic and the list of file numbers depends of
the route where the the consumer belongs to. Example:

I can't find a correlation to the camel route at this point.
I hope my problem is now a bit better explained.
I also tried similar with the GenericFileProcessStrategy and
PollingConsumerPollStrategy, but can't find a connection to the route.

Regards Helmut



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-RouteId-in-a-GenericFileFilter-tp5723631p5723643.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get RouteId in a GenericFileFilter ...

Posted by Christian Müller <ch...@gmail.com>.
I don't think I (and other users) understand what you try to do. Could you
share an example with us?

Best,
Christian

On Tue, Dec 4, 2012 at 9:07 PM, helmut.at.work <he...@gmail.com>wrote:

> appreciated