RE: HTTP keeps retrying after maximumRedeliveries set
Hi, it's not the HTTP producer endpoint that keeps retrying the message. That endpoint just fails and then the processing is complete. However this means that the file consumer in your route does not delete or move the file, so it's still there and the processing starts again with the next poll interval. There are different ways how to prevent this. The easiest is probably to set a parameter moveFailed=.error to the file endpoint (that will move failed files to a subfolder named .error). Best regards Stephan
Re: HTTP keeps retrying after maximumRedeliveries set
For troubleshooting purposes, I split the route into 2, one with just sending HTTP message and another one doing reading from file + transformations. When I call the HTTP part only, it does try only once, like you said. But when I run the whole route from the file: point, if exception happens during last HTTP call – it will keep retrying 20+ times (maybe it’s infinite loop, I just didn’t wait longer). PS. log(“${body}”) doesn’t print HTTP reply body in case of exception, but HTTP request body. Still didn’t figure out how to print a reply if a call failed. onException(Exception.class) .log("${exception.message}"); .log("${body}"); from("file:" + instructionsFolder) .to("xslt:xslt/oracleerp-to-payment.xslt") .split(xpath("//Payment")) .marshal().xmljson() .to("direct:sendPayment") ; from("direct:sendPayment") .setHeader(Exchange.HTTP_METHOD, constant("POST")) .setHeader(Exchange.CONTENT_TYPE, constant("application/json")) .to("http://localhost:8100/api/v1/myendpoint";) .log("${body}") It keeps repeating this message in log: 2016-10-13 07:58:27.695 WARN 63708 --- [acle-financials] o.a.c.c.file.GenericFileOnCompletion : Rollback file strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@3d0605e8 for file: GenericFile[test.xml] 2016-10-13 07:58:28.210 INFO 63708 --- [acle-financials] net.sf.json.xml.XMLSerializer: Using default type string 2016-10-13 07:58:28.211 INFO 63708 --- [acle-financials] route1 : {"MyJSON: 1212121 "} 2016-10-13 07:58:28.212 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : I/O exception (java.net.ConnectException) caught when processing request: Connection refused 2016-10-13 07:58:28.212 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : Retrying request 2016-10-13 07:58:28.213 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : I/O exception (java.net.ConnectException) caught when processing request: Connection refused 2016-10-13 07:58:28.213 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : Retrying request 2016-10-13 07:58:28.213 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : I/O exception (java.net.ConnectException) caught when processing request: Connection refused 2016-10-13 07:58:28.213 INFO 63708 --- [acle-financials] o.a.c.httpclient.HttpMethodDirector : Retrying request 2016-10-13 07:58:28.213 INFO 63708 --- [acle-financials] route2 : Connection refused 2016-10-13 07:58:28.214 ERROR 63708 --- [acle-financials] o.a.camel.processor.DefaultErrorHandler : Failed delivery for (MessageId: ID-raptor-local-61354-1476370696838-0-31 on ExchangeId: ID-raptor-local-61354-1476370696838-0-32). Exhausted after delivery attempt: 1 caught: java.net.ConnectException: Connection refused. Processed by failure processor: FatalFallbackErrorHandler[Channel[Log(route2)[exchangeExceptionMessage]]] Message History --- RouteId ProcessorId Processor Elapsed (ms) [route1] [route1] [file://input/oracle-financials ] [12] [route1] [marshal1 ] [marshal[org.apache.camel.model.dataformat.XmlJsonDataFormat@1b320d72] ] [ 2] [route1] [log2 ] [log ] [ 0] [route1] [to2 ] [direct:sendPayment ] [ 2] [route2] [setHeader1] [setHeader[CamelHttpMethod] ] [ 0] [route2] [setHeader2] [setHeader[Content-Type] ] [ 0] [route2] [to3 ] [http://localhost:8100/api/v1/payments ] [ 2] [ ] [log1 ] [log ] [ 0] Stacktrace --- java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socke
Re: HTTP keeps retrying after maximumRedeliveries set
Hello, You shouldn't need to set the max retry count to 0 as it is the default. If that is the full log I suspect that is one try, try enabling debug logging or checking the Web servers access togs to confirm. The first two are info then the error stating it tried once. Exhausted after delivery attempt: 1 Can you add log("$(body)") in the onexception definition to print the body? I am not sure it will print the response body, I would be surprised if it didn't. - J On Thu, 13 Oct 2016, 21:25 Val wrote: > Hello, > > > > Could you please advise why automatic retries happen even if I set > maximumRedeliveries to 0? Basically I just want to disable retries. > > > > And also, how do I print HTTP response body in case it’s an error code? > ${exception} only has a short description that HTTP call to my URL failed > with error code. Server returns details in HTTP response. > > > > onException(Exception.class) > > .maximumRedeliveries(0); > > > > from("direct:send") > > .setHeader(Exchange.HTTP_METHOD, constant("POST")) > > .setHeader(Exchange.CONTENT_TYPE, constant("application/json")) > > .to("http://localhost:8100/";) > > .log("${body}"); > > > > In 3 different cases (URL is not available, server code 400 or 500) I get > numerous retries before it finally stop: > > > > 2016-10-12 13:11:57.397 INFO 58522 --- [] > route2 : HTTP operation failed invoking > http://localhost:8100/ with statusCode: 400 > > 2016-10-12 13:11:57.397 INFO 58522 --- [] route2 > : > org.apache.camel.http.common.HttpOperationFailedException: HTTP operation > failed invoking http://localhost:8100/ with statusCode: 400 > > 2016-10-12 13:11:57.399 ERROR 58522 --- [] > o.a.camel.processor.DefaultErrorHandler : Failed delivery for (MessageId: > ID-raptor-local-64577-1476303106751-0-11 on ExchangeId: > ID-raptor-local-64577-1476303106751-0-12). Exhausted after delivery > attempt: 1 caught: > org.apache.camel.http.common.HttpOperationFailedException: HTTP operation > failed invoking http://localhost:8100/ with statusCode: 400. Processed > by failure processor: > FatalFallbackErrorHandler[Pipeline[[Channel[Log(route2)[exchangeExceptionMessage]], > Channel[Log(route2)[exchangeException] > > > >
HTTP keeps retrying after maximumRedeliveries set
Hello, Could you please advise why automatic retries happen even if I set maximumRedeliveries to 0? Basically I just want to disable retries. And also, how do I print HTTP response body in case it’s an error code? ${exception} only has a short description that HTTP call to my URL failed with error code. Server returns details in HTTP response. onException(Exception.class) .maximumRedeliveries(0); from("direct:send") .setHeader(Exchange.HTTP_METHOD, constant("POST")) .setHeader(Exchange.CONTENT_TYPE, constant("application/json")) .to("http://localhost:8100/";) .log("${body}"); In 3 different cases (URL is not available, server code 400 or 500) I get numerous retries before it finally stop: 2016-10-12 13:11:57.397 INFO 58522 --- [] route2 : HTTP operation failed invoking http://localhost:8100/ with statusCode: 400 2016-10-12 13:11:57.397 INFO 58522 --- [] route2 : org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:8100/ with statusCode: 400 2016-10-12 13:11:57.399 ERROR 58522 --- [] o.a.camel.processor.DefaultErrorHandler : Failed delivery for (MessageId: ID-raptor-local-64577-1476303106751-0-11 on ExchangeId: ID-raptor-local-64577-1476303106751-0-12). Exhausted after delivery attempt: 1 caught: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:8100/ with statusCode: 400. Processed by failure processor: FatalFallbackErrorHandler[Pipeline[[Channel[Log(route2)[exchangeExceptionMessage]], Channel[Log(route2)[exchangeException]
HTTP keeps retrying after maximumRedeliveries set
Hello, Could you please advise why automatic retries happen even if I set maximumRedeliveries to 0? Basically I just want to disable retries. And also, how do I print HTTP response body in case it’s an error code? ${exception} only has a short description that HTTP call to my URL failed with error code. Server returns details in HTTP response. onException(Exception.class) .maximumRedeliveries(0); from("direct:send") .setHeader(Exchange.HTTP_METHOD, constant("POST")) .setHeader(Exchange.CONTENT_TYPE, constant("application/json")) .to("http://localhost:8100/";) .log("${body}"); In 3 different cases (URL is not available, server code 400 or 500) I get numerous retries before it finally stop: 2016-10-12 13:11:57.397 INFO 58522 --- [] route2 : HTTP operation failed invoking http://localhost:8100/ with statusCode: 400 2016-10-12 13:11:57.397 INFO 58522 --- [] route2 : org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:8100/ with statusCode: 400 2016-10-12 13:11:57.399 ERROR 58522 --- [] o.a.camel.processor.DefaultErrorHandler : Failed delivery for (MessageId: ID-raptor-local-64577-1476303106751-0-11 on ExchangeId: ID-raptor-local-64577-1476303106751-0-12). Exhausted after delivery attempt: 1 caught: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:8100/ with statusCode: 400. Processed by failure processor: FatalFallbackErrorHandler[Pipeline[[Channel[Log(route2)[exchangeExceptionMessage]], Channel[Log(route2)[exchangeException] -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-keeps-retrying-after-maximumRedeliveries-set-tp5788708.html Sent from the Camel - Users mailing list archive at Nabble.com.