Re: Help: FTP/SFTP File Delete Problem and FTP/SFTP Polling Problem

2015-01-12 Thread Claus Ibsen
Hi

You can use a route policy, and then stop the consumer in onExchangeDone
http://camel.apache.org/routepolicy.html

On Mon, Jan 12, 2015 at 8:31 AM, yeandone willcours...@gmail.com wrote:
 Will there be any risks if I stop route like that? After the exchange is
 processed by both end endpoints direct a and direct b. I need to stop the
 route so that the consumer can stop polling. Can you please give some ideas
 to stop route/consumer properly so that the route and consumer will stop
 properly without any risks?

 On Sun, Jan 11, 2015 at 9:36 PM, Claus Ibsen-2 [via Camel] 
 ml-node+s465427n5761572...@n5.nabble.com wrote:

 On Sun, Jan 11, 2015 at 3:48 AM, yeandone [hidden email]
 http:///user/SendEmail.jtp?type=nodenode=5761572i=0 wrote:

  Thanks, Claus. Will try a new version. But do you know why it always
  prompts the following warnings when the routes stops? Will they impact
  anything and the original file?
 
  1. If choose not to delete the file, it prompts when the route stops:
 
  WARN Camel (platformSchedulerCamel) thread #7 - sftp://xxx
  org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
  strategy:
 
 org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@4b474b47
  for file: RemoteFile[a.txt]
 

 Its because you stop the route from the route, eg then the current
 exchange is forced to be stopped and thus wants to rollback.



  2. If choose not to delete the file, it prompts when the route stops:
  WARN Camel (platformSchedulerCamel) thread #7 - sftp://xxx
  org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
  strategy:
 
 org.apache.camel.component.file.strategy.GenericFileNoOpProcessStrategy@4b474b47
  for file: RemoteFile[a.txt]
 
 
 
  On Fri, Jan 9, 2015 at 11:24 PM, Claus Ibsen-2 [via Camel] 
  [hidden email] http:///user/SendEmail.jtp?type=nodenode=5761572i=1
 wrote:
 
  Try with newer release, there may have been a bug fix
 
  On Fri, Jan 9, 2015 at 6:47 PM, yeandone [hidden email]
  http:///user/SendEmail.jtp?type=nodenode=5761545i=0 wrote:
 
   HI, Claus.
  
 Thanks for the prompt reply! I am using Camel 2.12. I also tried
  adding
   aync=true in controlbus
   to
 uri=controlbus:route?routeId=A_Routeamp;aync=trueamp;action=stop
  /
  
 It does help delete the file, but it has some issues with polling.
  Until
   the file get deleted and control bus stops, the route still keeps
  polling
   for a while. What I want to do is deleting original file after it's
   processed by direct: a and direct: b and then stop the route which
 will
  stop
   the file polling from the sftp location. If nothing is picked, then I
  want
   to do some processing in direct:b and then stop the route and polling
   immediately.  Any ideas to resolve the issue?
  
Thanks
  
  
  
   --
   View this message in context:
 
 http://camel.465427.n5.nabble.com/Help-FTP-SFTP-File-Delete-Problem-and-FTP-SFTP-Polling-Problem-tp5761486p5761535.html
   Sent from the Camel - Users mailing list archive at Nabble.com.
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: [hidden email]
  http:///user/SendEmail.jtp?type=nodenode=5761545i=1
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/
 
 
  --
   If you reply to this email, your message will be added to the
 discussion
  below:
 
 
 http://camel.465427.n5.nabble.com/Help-FTP-SFTP-File-Delete-Problem-and-FTP-SFTP-Polling-Problem-tp5761486p5761545.html
   To unsubscribe from Help: FTP/SFTP File Delete Problem and FTP/SFTP
  Polling Problem, click here
  
  .
  NAML
  
 http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml

 
 
 
 
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Help-FTP-SFTP-File-Delete-Problem-and-FTP-SFTP-Polling-Problem-tp5761486p5761561.html
  Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: [hidden email]
 http:///user/SendEmail.jtp?type=nodenode=5761572i=2
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://camel.465427.n5.nabble.com/Help-FTP-SFTP-File-Delete-Problem-and-FTP-SFTP-Polling-Problem-tp5761486p5761572.html
  To unsubscribe from Help: FTP/SFTP File Delete Problem and FTP/SFTP
 Polling Problem, click here
 

Re: Rest DSL: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis

2015-01-12 Thread Ettore Giallaurito
Hi Claus,

great thanks for your help.

Regards,
Ettore.

On Sun Jan 11 2015 at 10:04:34 AM Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Ah spotted the issue. I have logged a ticket
 https://issues.apache.org/jira/browse/CAMEL-8227

 You can use .to(ExchangePattern.InOnly, jms:xxx) as the solution.

 On Sun, Jan 11, 2015 at 10:52 AM, Claus Ibsen claus.ib...@gmail.com
 wrote:
  Hi
 
  Not sure what is wrong there. But setting exchangePattern=InOnly works
  in unit tests.
  You could try setting disableReplyTo=true as a workaround
 
 
  On Fri, Jan 9, 2015 at 3:05 PM, Ettoregia ettore...@gmail.com wrote:
  Hi All,
 
  I'm facing a problem which I guess stems from the usage of MEP.
 
  Actually when I hit the http://localhost:8082/user/ by using a PUT
 verb, the
  client hangs for
  20 millis and then an exception is raised (see below). I thought that by
  specifying the exchangePattern=InOnly
  Camel should return a response back straight away.
 
  Any ideas?
 
  
 --
  restConfiguration().component(jetty).bindingMode(
 RestBindingMode.json)
  .host(localhost).port(8082);
 
  rest(/user).description(User rest service).consumes(
 application/json)
 
  .put().description(Updates or create a user)
  .route()
  .choice()
  .when(header(firstInvocation))
  .to(activemq:queue1?
 exchangePattern=InOnly)
  .log(# Order received
 from browser rest client #)
  .otherwise()
  .log(# All done
 #)
  .to(mock:result)
  .endChoice().endRest()
 
  
 ---
  org.apache.camel.ExchangeTimedOutException: The OUT message was not
 received
  within: 2 millis due reply message with correlationID:
  corrID0 not received. Exchange[Message:
  {replyQueue1=replyQueue1, height=46, weight=34, age=29}]
  at
  org.apache.camel.component.jms.reply.ReplyManagerSupport.processReply(
 ReplyManagerSupport.java:133)
  at
  org.apache.camel.component.jms.reply.TemporaryQueueReplyHandler.
 onTimeout(TemporaryQueueReplyHandler.java:61)
  at
  org.apache.camel.component.jms.reply.CorrelationTimeoutMap.onEviction(
 CorrelationTimeoutMap.java:54)
  at
  org.apache.camel.component.jms.reply.CorrelationTimeoutMap.onEviction(
 CorrelationTimeoutMap.java:30)
  at
  org.apache.camel.support.DefaultTimeoutMap.purge(
 DefaultTimeoutMap.java:212)
  at
  org.apache.camel.support.DefaultTimeoutMap.run(
 DefaultTimeoutMap.java:162)
  at java.util.concurrent.Executors$RunnableAdapter.
 call(Executors.java:471)
  at java.util.concurrent.FutureTask.runAndReset(
 FutureTask.java:304)
  at
  java.util.concurrent.ScheduledThreadPoolExecutor$
 ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
  at
  java.util.concurrent.ScheduledThreadPoolExecutor$
 ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(
 ThreadPoolExecutor.java:1145)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(
 ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
  
 ---
 
  Regards,
  Ettore.
 
 
 
  --
  View this message in context: http://camel.465427.n5.nabble.
 com/Rest-DSL-org-apache-camel-ExchangeTimedOutException-The-
 OUT-message-was-not-received-within-2-mis-tp5761530.html
  Sent from the Camel - Users mailing list archive at Nabble.com.
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: cib...@redhat.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8 http://hawt.io/fabric8: http://fabric8.io/



Possibility to track (monitor) inbound/outbound messages (request/response)

2015-01-12 Thread hanusto
Hello everybody,

I am looking for the best way how to track or monitor (for example persist
info into database) inbound message (we are a server) such as request (for
example for WS) and our response (or fail).

For example, for the same functionality for outbound messages (where we are
client) we use custom implementation of
EventNotifierBaseExchangeSendingEvent for sending and ExchangeSentEvent
for info about received response.

I found JPA implementation for tracing messages
(http://camel.apache.org/tracer-example.html) using tracer. But for now I
don't know what can I expect from it.

Requirements are:
- trace inbound requests (messages) and responses for there (without
complete flow of route - no tracing the route)
- if some error occurs we need trace errors
- it could be based upon FromEndpoint - trace message only if
FromEndpoint is registered, otherwise no

Camel provides TraceEventHandler, maybe it is one way how to resolve it? For
implementation I would create custom Camel endpoint (as Tracer endpoint)
which encapsulates of persisting JpaTraceEventMessage entity. This component
will route JpaTraceEventMessage  to JPA endpoint only if FromEndpoint will
be configured as accepted, otherwise no. For pairing requests and responses
I can use ExchangeId. But how to resolve last node in route, ToNode will
be blank? In Out.Body there will be response, right? 

Or Camel provides some types of events such as
ExchangeSendingEvent/ExchangeSentEvent?

Thank you very much in advice

Tomas



--
View this message in context: 
http://camel.465427.n5.nabble.com/Possibility-to-track-monitor-inbound-outbound-messages-request-response-tp5761583.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: onException is ignored

2015-01-12 Thread James Green
Mea culpa. Who knew AccountNumberFoundException was part of
javax.security..! Fixed the import, the onException now executes.

However, the .log line:
.log(LoggingLevel.ERROR, com.foo.server.ngw, Account Not
Found. Message discarded.).stop();

Actually writes the line:

14:22:03,993 ERROR org.slf4j.helpers.MarkerIgnoringBase:145 error() -
Account Not Found. Message discarded.

So what was the point of supplying a logName?


On 12 January 2015 at 12:05, James Green james.mk.gr...@gmail.com wrote:

 As suggested:

 errorHandler(transactionErrorHandler().maximumRedeliveries(3));
 onException(AccountNotFoundException.class)
 .log(LoggingLevel.ERROR, com.foo.server.ngw, Account
 Not Found. Message discarded.).stop();


 from(source())
 .transacted()
 .unmarshal(jacksonUnmarshall)
 .process(router)
 .recipientList(simple(${body.media}));

 I can see Camel attempt redelivery three times as a result of catching
 AccountNotFoundException. After the fourth and final attempt fails I can't
 actually see much different to that logged for the previous three attempts.
 I've kept the reporting down to what I hope is pertinent below:

 10:32:23,885 ERROR org.slf4j.helpers.MarkerIgnoringBase:161 error() -
 Failed delivery for (MessageId:
 queue_inbound_ID_JGREENWIN7-54570-142105884-3_1_1_1_3 on ExchangeId:
 ID-JGREENWIN7-54739-1421058738390-0-6). Exhausted after delivery attempt: 4
 caught: com.foo.server.ngw.router.AccountNotFoundException: Account not
 found
 ...
 10:32:23,932  WARN org.apache.camel.spring.spi.TransactionErrorHandler:287
 logTransactionRollback() - Transaction rollback (0x2017df6a)
 redelivered(true) for (MessageId:
 ID:JGREENWIN7-54570-142105884-3:1:1:1:3 on ExchangeId:
 ID-JGREENWIN7-54739-1421058738390-0-7) caught:
 com.foo.server.ngw.router.AccountNotFoundException: Account not found
 10:32:23,932  WARN org.slf4j.helpers.MarkerIgnoringBase:136 warn() -
 Execution of JMS message listener failed. Caused by:
 [org.apache.camel.RuntimeCamelException -
 com.foo.server.ngw.router.AccountNotFoundException: Account not found]
 org.apache.camel.RuntimeCamelException:
 com.foo.server.ngw.router.AccountNotFoundException: Account not found
 at
 org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1364)
 at
 org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:188)
 at
 org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
 at
 org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
 at
 org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)
 at
 org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)
 at
 org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)
 at
 org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)
 at
 org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
 at
 org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
 at
 org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
 at
 org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
 at
 org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)
 at
 org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
 at
 org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
 at
 org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
 at
 org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
 at
 org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
 at
 org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
 at
 org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
 at
 org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
 Caused by: 

Re: onException is ignored

2015-01-12 Thread James Green
So when using onException it's really important not to use a component that
is already partaking in the transaction being rolled back? I get that now,
but it's not immediately obvious.

Does this explain why the log()ged message, Account Not Found. Message
discarded. does not appear in the console though?

On 10 January 2015 at 07:23, Willem Jiang willem.ji...@gmail.com wrote:

 If the Exception is thrown from the source() endpoint, the onException
 error handler won’t work as you expected.

 --
 Willem Jiang

 Red Hat, Inc.
 Web: http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (English)
 http://jnn.iteye.com (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem



 On January 10, 2015 at 1:38:52 AM, James Green (james.mk.gr...@gmail.com)
 wrote:
  Project is Spring based with Camel 2.14 and the following configuration:
 
  onException(AccountNotFoundException.class)
  .log(Account Not Found. Message
  discarded.).to(jms:queue:RouterAccountNotFound).stop();
 
  errorHandler(transactionErrorHandler().maximumRedeliveries(3));
 
  from(source())
  .transacted()
  .unmarshal(jacksonUnmarshall)
  .process(router)
  .recipientList(simple(${body.media}));
 
  We have a JMS connection and a JPA connection wrapped in a Atomikos
  transaction manager (a XA transaction manager I understand to be
 required).
  The above errorHandler triggers if the router throws an Exception, but
 the
  onException statement does not fire despite the logs recording the
  AccountNotFoundException being caught by Camel.
 
  Consequently the log()ing and the RouterAccountNotFound queue do not fire
  at all.
 
  The documentation suggests onException should be usable at this point.
 Can
  anyone suggest why the above only partly works?
 
  Thanks,
 
  James
 




Re: onException is ignored

2015-01-12 Thread Claus Ibsen
Hi

No the onException should be triggered even for TX.

You may try to configure onException after errorHandler.


On Mon, Jan 12, 2015 at 11:02 AM, James Green james.mk.gr...@gmail.com wrote:
 So when using onException it's really important not to use a component that
 is already partaking in the transaction being rolled back? I get that now,
 but it's not immediately obvious.

 Does this explain why the log()ged message, Account Not Found. Message
 discarded. does not appear in the console though?

 On 10 January 2015 at 07:23, Willem Jiang willem.ji...@gmail.com wrote:

 If the Exception is thrown from the source() endpoint, the onException
 error handler won’t work as you expected.

 --
 Willem Jiang

 Red Hat, Inc.
 Web: http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (English)
 http://jnn.iteye.com (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem



 On January 10, 2015 at 1:38:52 AM, James Green (james.mk.gr...@gmail.com)
 wrote:
  Project is Spring based with Camel 2.14 and the following configuration:
 
  onException(AccountNotFoundException.class)
  .log(Account Not Found. Message
  discarded.).to(jms:queue:RouterAccountNotFound).stop();
 
  errorHandler(transactionErrorHandler().maximumRedeliveries(3));
 
  from(source())
  .transacted()
  .unmarshal(jacksonUnmarshall)
  .process(router)
  .recipientList(simple(${body.media}));
 
  We have a JMS connection and a JPA connection wrapped in a Atomikos
  transaction manager (a XA transaction manager I understand to be
 required).
  The above errorHandler triggers if the router throws an Exception, but
 the
  onException statement does not fire despite the logs recording the
  AccountNotFoundException being caught by Camel.
 
  Consequently the log()ing and the RouterAccountNotFound queue do not fire
  at all.
 
  The documentation suggests onException should be usable at this point.
 Can
  anyone suggest why the above only partly works?
 
  Thanks,
 
  James
 





-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: onException is ignored

2015-01-12 Thread James Green
As suggested:

errorHandler(transactionErrorHandler().maximumRedeliveries(3));
onException(AccountNotFoundException.class)
.log(LoggingLevel.ERROR, com.foo.server.ngw, Account Not
Found. Message discarded.).stop();


from(source())
.transacted()
.unmarshal(jacksonUnmarshall)
.process(router)
.recipientList(simple(${body.media}));

I can see Camel attempt redelivery three times as a result of catching
AccountNotFoundException. After the fourth and final attempt fails I can't
actually see much different to that logged for the previous three attempts.
I've kept the reporting down to what I hope is pertinent below:

10:32:23,885 ERROR org.slf4j.helpers.MarkerIgnoringBase:161 error() -
Failed delivery for (MessageId:
queue_inbound_ID_JGREENWIN7-54570-142105884-3_1_1_1_3 on ExchangeId:
ID-JGREENWIN7-54739-1421058738390-0-6). Exhausted after delivery attempt: 4
caught: com.foo.server.ngw.router.AccountNotFoundException: Account not
found
...
10:32:23,932  WARN org.apache.camel.spring.spi.TransactionErrorHandler:287
logTransactionRollback() - Transaction rollback (0x2017df6a)
redelivered(true) for (MessageId:
ID:JGREENWIN7-54570-142105884-3:1:1:1:3 on ExchangeId:
ID-JGREENWIN7-54739-1421058738390-0-7) caught:
com.foo.server.ngw.router.AccountNotFoundException: Account not found
10:32:23,932  WARN org.slf4j.helpers.MarkerIgnoringBase:136 warn() -
Execution of JMS message listener failed. Caused by:
[org.apache.camel.RuntimeCamelException -
com.foo.server.ngw.router.AccountNotFoundException: Account not found]
org.apache.camel.RuntimeCamelException:
com.foo.server.ngw.router.AccountNotFoundException: Account not found
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1364)
at
org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:188)
at
org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)
at
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)
at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103)
at
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.foo.server.ngw.router.AccountNotFoundException: Account not
found
at
com.foo.server.ngw.router.MessageToSendFactory.create(MessageToSendFactory.java:29)
at com.foo.server.ngw.router.MediaRouter.process(MediaRouter.java:31)
at
org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)
at

Re: Timeout Exception in S3 download

2015-01-12 Thread Shing Hing Man
I've  added the delay and maxMessagePerPoll, as you suggested,  to the path, 
but I still get the same timeout exception.
Shing 
 

 On Monday, 12 January 2015, 2:10, Willem Jiang willem.ji...@gmail.com 
wrote:
   

 
Can you increase the delay option and maxMessagePerPoll to see if the error is 
still there?

from(aws-s3://MyBucket?amazonS3Client=#clientdelay=5000maxMessagesPerPoll=5)
.to(mock:result”);

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 10, 2015 at 10:44:44 PM, Shing Hing Man (mat...@yahoo.com.invalid) 
wrote:
  
 I am using Apache Camel 2.14.1. I have set up the following S3 route to 
 download from a S3  
 Bucket.
 String bucketName = myBucket; String prefix = out; String 
 awsURLTemplate=aws-s3://%s?accessKey=%ssecretKey=RAW(%s)®ion=eu-west-1prefix=%sdeleteAfterRead=false;
   
 final String awsURL = String.format(awsURLTemplate,bucketName, 
 accessKey,secretKey,prefix);  
 DefaultCamelContext context = new DefaultCamelContext(); 
 context.addRoutes(new  
 RouteBuilder() { public void configure() { // Only download 
 {myBucket}/out/**.txt}.  
 from(awsURL).filter().simple(${header.camelawss3key} regex '.*\\.txt') 
 .setHeader(Exchange.FILE_NAME,  
 simple(${header.camelawss3key})).to(file:camel/in); } }); 
 context.start();  
 Thread.sleep(60);
 When the above is run, all the txt files in S3 myBucket/out are downloaded. 
 But about 1  
 minute later (without adding any files to the bucket), I get the following 
 timeout exception.[ead  
 #0 - aws-s3://camel-lombok] AmazonHttpClient INFO Unable to execute HTTP 
 request:  
 Timeout waiting for connection from 
 poolorg.apache.http.conn.ConnectionPoolTimeoutException:  
 Timeout waiting for connection from pool at 
 org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:226)[httpclient-4.3.4.jar:4.3.4]
   
 at 
 org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:195)[httpclient-4.3.4.jar:4.3.4]
   
 at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_40]
   
 at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_40] at 
 com.amazonaws.http.conn.ClientConnectionRequestFactory$Handler.invoke(ClientConnectionRequestFactory.java:70)[aws-java-sdk-1.8.9.1.jar:]
   
 at com.amazonaws.http.conn.$Proxy13.getConnection(Unknown Source)[:] at 
 org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)[httpclient-4.3.4.jar:4.3.4]
   
 at 
 org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)[httpclient-4.3.4.jar:4.3.4]
   
 at 
 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)[httpclient-4.3.4.jar:4.3.4]
   
 at 
 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)[httpclient-4.3.4.jar:4.3.4]
   
 at 
 com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:464)[aws-java-sdk-1.8.9.1.jar:]
   
 at 
 com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:273)[aws-java-sdk-1.8.9.1.jar:]
   
 at 
 com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3660)[aws-java-sdk-1.8.9.1.jar:]
   
 at 
 com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1133)[aws-java-sdk-1.8.9.1.jar:]
   
 at 
 com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1005)[aws-java-sdk-1.8.9.1.jar:]
   
 at 
 org.apache.camel.component.aws.s3.S3Consumer.createExchanges(S3Consumer.java:104)[camel-aws-2.14.1.jar:2.14.1]
   
 at 
 org.apache.camel.component.aws.s3.S3Consumer.poll(S3Consumer.java:85)[camel-aws-2.14.1.jar:2.14.1]
   
 at 
 org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[camel-core-2.14.1.jar:2.14.1]
   
 at 
 org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[camel-core-2.14.1.jar:2.14.1]
   
 at 
 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_40]
   
 at 
 java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_40]  
 at 
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_40]
   
 at 
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_40]
   
 at 
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_40]
   
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_40]
   
 at java.lang.Thread.run(Thread.java:724)[:1.7.0_40]
 Thanks in advance for any assistance ! Shing
  
  


   

Re: error in reading FaceBook Endpoints

2015-01-12 Thread contactreji
Mahesh

I too had a try with the Facebook component. Doesn't seem to work the
straight forward way. 

Can someone help with inputs on this issue.

Cheers
Reji



--
View this message in context: 
http://camel.465427.n5.nabble.com/error-in-reading-FaceBook-Endpoints-tp5761510p5761605.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Possibility to track (monitor) inbound/outbound messages (request/response)

2015-01-12 Thread Willem Jiang
You may consider to use the OnCompletion[1] to process the response message.
[1]http://camel.apache.org/oncompletion.html


Willem Jiang

Red Hat, Inc.

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

On Mon, Jan 12, 2015 at 5:50 PM, hanusto hanu...@gmail.com wrote:

 Hello everybody,

 I am looking for the best way how to track or monitor (for example persist
 info into database) inbound message (we are a server) such as request (for
 example for WS) and our response (or fail).

 For example, for the same functionality for outbound messages (where we are
 client) we use custom implementation of
 EventNotifierBaseExchangeSendingEvent for sending and ExchangeSentEvent
 for info about received response.

 I found JPA implementation for tracing messages
 (http://camel.apache.org/tracer-example.html) using tracer. But for now I
 don't know what can I expect from it.

 Requirements are:
 - trace inbound requests (messages) and responses for there (without
 complete flow of route - no tracing the route)
 - if some error occurs we need trace errors
 - it could be based upon FromEndpoint - trace message only if
 FromEndpoint is registered, otherwise no

 Camel provides TraceEventHandler, maybe it is one way how to resolve it?
 For
 implementation I would create custom Camel endpoint (as Tracer endpoint)
 which encapsulates of persisting JpaTraceEventMessage entity. This
 component
 will route JpaTraceEventMessage  to JPA endpoint only if FromEndpoint
 will
 be configured as accepted, otherwise no. For pairing requests and responses
 I can use ExchangeId. But how to resolve last node in route, ToNode
 will
 be blank? In Out.Body there will be response, right?

 Or Camel provides some types of events such as
 ExchangeSendingEvent/ExchangeSentEvent?

 Thank you very much in advice

 Tomas



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Possibility-to-track-monitor-inbound-outbound-messages-request-response-tp5761583.html
 Sent from the Camel - Users mailing list archive at Nabble.com.