FTP route that could do move files upon an event

2016-01-10 Thread theLazyLad
Hi,

I need to develop a route wherein I can consume a file from an FTP location
and copy it to some other folder.
After that I need to send the path of the consumed file to a web service and
upon successful invocation of that service I need to move the file from the
initial FTP location to another folder.

Could anyone suggest the best possible way to achieve this?

Thanks in advance. :)



--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-route-that-could-do-move-files-upon-an-event-tp5776124.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: timer reschedule / loop between routes

2016-01-10 Thread Ravindra Godbole
Can you maintain a persistent state for directcaller ? If you can do that


1. Timer always executes at predefined interval [ 1 sec or whatever
2. direct:apiCaller maintains a state STARTED, INPROGRESS, FINISHED.
3. if next call from timer sees that state is INPROGRESS then nothing
happens. If it is FINISHED then new execution started.

-Ravi


On Fri, Jan 8, 2016 at 7:17 PM, zappee  wrote:

> Hi,
>
> I am new in Apache Camel and have an interesting scenario. Could you please
> help me?
>
> My current route looks like this:
> (1) mainRoute > timer://xxx?period=1, to: "direct:apiCaller"
> (2) apiCaller > retrieve data from restapi, to: "direct:persistData"
> (3) persistData > save data to database
>
> So every x second a restapi is called and the received data is persisted.
> It
> works fine. But I need to call the restapi continuously until it receives
> an
> empty answer in the rest response so I need to do a loop with (2) and (3)
> steps. And then if there is no more data at moment then have to wait till
> the next timer event is fired to start downloading the newcomer data if we
> have.
>
> So my route needs to do this:
> (1) route1 > timer://xxx?period=1, to: "direct:apiCaller"
> --> do
> (2) apiCaller > retrieve data from restapi, to: "direct:persistData"
> (3) persistData > save data to database
> --> while (answer of restapi is empty)
>
> My first idea was to reschedule the timer from 1 minutes to 1 sec in case
> of
> I have more data to download. And when we do not have more data to download
> then reschedule my timer from 1 sec to 1 min just because of wait till a
> little bit.
>
> But I am not able to reschedule the timer runntime so it needs to be some
> different solution to handle my use case.
>
> What is the best way to reach my target?
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/timer-reschedule-loop-between-routes-tp5776017.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Camel Netty4 component tcp client reconnect limit

2016-01-10 Thread Willem Jiang
I just checked the code, camel just calls the openChannel method recursively 
until the connection is established when starting the NettyConsumer in client 
mode.
It could be good idea to fail fast by throwing the exception out after a couple 
of retries.


--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 8, 2016 at 5:01:12 PM, Jojo Paderes (jojo.pade...@gmail.com) wrote:
> On Fri, Jan 8, 2016 at 4:50 PM, Claus Ibsen wrote:
>  
> >
> > I do not think so. But if there was such an option what should happen
> > after the exception? Should it just never try again? Or is the idea to
> > have an error being logged every 20th failed attempt or something?
> >
> >
> What I have in mind is that the tcp client will reconnect for a certain
> number of attempts (can be set as an option in the endpoint url), and if
> the connection still fails after x attempts an exception is thrown (which
> is then handled in Camel error handling).
>  



Re: deadLetterHandleNewException(false) seems to not work as expected

2016-01-10 Thread Willem Jiang
Can you share your camel route with us?


--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 8, 2016 at 11:54:55 PM, lchdev (lch...@outlook.be) wrote:
> - Bump -
>  
> Still having to work around the issue. Anyone having an idea ?
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/deadLetterHandleNewException-false-seems-to-not-work-as-expected-tp5775138p5776020.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Re: Missing JmsQueueEndpoint.queueSize() method in 2.16.1

2016-01-10 Thread Claus Ibsen
Its from ManagedBrowsableEndpointMBean and only available in JMX.

You can get the size yourself with calling

getExchanges().size();



On Fri, Jan 8, 2016 at 11:45 AM, Stijn Haezebrouck
 wrote:
> The queueSize() method is documented in the JavaDoc "current", see
> link-to-currentJmsQueueEndpoint javadoc
> 
>
> However, when using the current version of apache camel-jms, which is
> version 2.16.1 at the time of writing, I see that the method is just not
> there. (Decompiled JmsQueueEndpoint in the camel-jms jar version 2.16.1).
> When switching back to 2.15.5, the method is there.
>
> So either the method must be present in version 2.16.1, as documented. Or
> either the method has disappeared in 2.16.1, but the javadoc is wrong.
>
> Or the "current" versions does not correct to the latest release of camel,
> which is 2.16.1 at the time of writing (according to
> http://camel.apache.org/download.html
> 
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Missing-JmsQueueEndpoint-queueSize-method-in-2-16-1-tp5776012.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: timer reschedule / loop between routes

2016-01-10 Thread zappee
thx!



--
View this message in context: 
http://camel.465427.n5.nabble.com/timer-reschedule-loop-between-routes-tp5776017p5776100.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel jetty filtersRef how to set init parameters for filter

2016-01-10 Thread Willem Jiang
As camel-jetty doesn’t leverage the web.xml to setup the filters, I don’t think 
there is a blocker when calling the filter init method yourself. 
When you setup the filters instance to the Camel registry, you can call the 
filter init method to pass the parameters yourself.


--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 10, 2016 at 2:27:44 AM, J- (jmand...@hotmail.com) wrote:
> Hi i see how you can set a servlet filter on the Jetty component with the 
> filtersRef option,  
> but i need to set a couple init parameters on the filter object when it's 
> init gets called.  
>  
>  
> Is this possible to do?
>  
>  
> Thanks.
>  



Re: Camel jetty filtersRef how to set init parameters for filter

2016-01-10 Thread J-
The problem is, when jetty starts up the filter it calls the filters init 
method again essentially erasing whatever i set in the init manually.

-J


From: Willem Jiang 
Sent: Sunday, January 10, 2016 4:47 AM
To: users@camel.apache.org; J-
Subject: Re: Camel jetty filtersRef how to set init parameters for filter

As camel-jetty doesn’t leverage the web.xml to setup the filters, I don’t think 
there is a blocker when calling the filter init method yourself.
When you setup the filters instance to the Camel registry, you can call the 
filter init method to pass the parameters yourself.


--
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem



On January 10, 2016 at 2:27:44 AM, J- (jmand...@hotmail.com) wrote:
> Hi i see how you can set a servlet filter on the Jetty component with the 
> filtersRef option,
> but i need to set a couple init parameters on the filter object when it's 
> init gets called.
>
>
> Is this possible to do?
>
>
> Thanks.
>



Re: deadLetterHandleNewException(false) seems to not work as expected

2016-01-10 Thread Claus Ibsen
Hi

This is as expected. The option deadLetterHandleNewException is only
for new errors happening while the dead letter channel is processing
the message.

Your code just routes to a log as the dead letter channel and there is
no exception thrown.

See this unit test for an example
https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelNotHandleNewExceptionTest.java

On Wed, Dec 16, 2015 at 11:32 AM, lchdev  wrote:
> I am trying to use the option /deadLetterHandleNewException(false)/ in order
> to have any new Exception occurring during the dead letter processing be
> propagated back. Unfortunately, when doing so, it seems that the dead letter
> channel propagates back the original exception as well, even if the
> DeadLetterChannel succeeded. This is definitely not the behavior that I
> expected.
>
> This has been tested with Camel 2.15.3 and 2.16.1, both behave in the same
> (unexpected) way. Am I misconfiguring or misusing something ? Or is it a bug
> ? Here is a simple route (Java DSL) that is sufficient to illustrate the
> behavior:
>
>
> Sending a message to this route will trigger an Exception that will be
> propagated back to the producer, even if we can see in the logs that the
> DeadLetterChannel has successfully *handled* the exception.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/deadLetterHandleNewException-false-seems-to-not-work-as-expected-tp5775138.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: org.apache.camel.InvalidPayloadException after adding a @PreAuthorized Annotation to service method

2016-01-10 Thread Claus Ibsen
Hi

How do you call that bean method - sendMailStandardAsync ?

Do you call it from another route or some java bean?

And is there more in the stacktrace? I wonder what that Map contains? I can
only assume spring do some proxy stuff and change the method parameters or
something.

If you can setup a sample project on github, then I can use that to debug.
Maybe we can detect this spring proxy stuff and unwrap the parameter from
the map and call the method with the right parameters.

On Thu, Jan 7, 2016 at 12:46 PM, Brendle, Detlef <
detlef.bren...@prospective.ch> wrote:

> PreAuthorize is a security annotation from Spring.
>
> org.springframework.security.access.prepost.PreAuthorize
>
> @Target({ ElementType.METHOD, ElementType.TYPE })
> @Retention(RetentionPolicy.RUNTIME)
> @Inherited
> @Documented
> public @interface PreAuthorize {
>/**
> * @return the Spring-EL expression to be evaluated before invoking the 
> protected
> * method
> */
>String value();
> }
>
>
>
> 2016-01-07 12:42 GMT+01:00 Claus Ibsen :
>
>> Maybe the annotations creates some kind of proxy object that has a
>> method signature with a different type than the method itself.
>>
>> Where is that @PreAuthorize coming from?
>>
>> On Thu, Jan 7, 2016 at 12:38 PM, Brendle, Detlef
>>  wrote:
>> > Hi all,
>> >
>> > I am facing an issue that I dont know how to solve.
>> > For Security Reasons I needed to secure a service method that is also
>> > called from a camel route.
>> >
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > OK
>> > 
>> > 
>> >
>> >
>> >
>> > @PreAuthorize("hasRole('" + BerechtigungName.ROLE_USER + "')")
>> > public void sendMailStandardAsync(*MailInfo* mailInfo) {
>> > LOG.info("Sending email to [{}]", mailInfo.getTo());
>> > template.sendBody("direct:sendMailStandardAsync", mailInfo);
>> > }
>> >
>> > But now If the route is called I get an Exception:
>> >
>> > *No type converter available to convert from type:
>> > ch.prospective.njc.integration.mail.service.MailInfo to the required
>> > type: java.util.Map with value MailInfo*
>> >
>> >
>> > If I remove the Annotation again, everything works fine. So I assume
>> that
>> > somehow the annotation becomes part of the camel treatment.
>> >
>> > Does anybody know how to solve this issue ?
>> >
>> >
>> > Thanks,
>> > Detlef
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>
>
> --
>
> Prospective Media Services
>
> Hofackerstrasse 32
>
> CH-8032 Zürich
>
>
>
> Phone  +41 44 384 55 19
>
> detlef.bren...@prospective.ch 
>
> www.prospective.ch
>
> blog.prospective.ch
>
>
> [image: Inline-Bild 1]   [image: Inline-Bild
> 8]   [image: Inline-Bild 7]
> 
> [image: Inline-Bild 5]   [image:
> Inline-Bild 3] 
> [image: Inline-Bild 4]
>   [image:
> Inline-Bild 6]
>   [image:
> Inline-Bild 10]   [image:
> Inline-Bild 9]   [image:
> Inline-Bild 2] 
>
> PROSPECTIVE – FÜR UMFASSENDE RECRUITING-SOLUTIONS
>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Producer Template // Count mismatch

2016-01-10 Thread Reji Mathews
Hey Saurabh

Thanks for ur solution . It was indeed perfect. I overlooked on the fact
that java works on call by reference model and it's always pointers to the
memory location.
We fixed it by using Cloned objects

Cheers
Reji
On 7 Jan 2016 02:49, "CamelNayar"  wrote:

> Reji,
>
> I am not sure why you are facing the problem but something looks off with
> the example. You are passing an object "batch" to vm component and clearing
> the object in next line. vm component is asynchronous - so the object you
> are trying to pass will clear once you do batch.clear().
>
> Regards,
> Saurabh Nayar
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Producer-Template-Count-mismatch-tp5775891p5775932.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>