What is it exactly that fails? I don't see anywhere in your code where you invoke a processor? Where exactly does the exception occur?
On Thu, Jun 29, 2017 at 12:18 AM, craig.w [via Camel] < [email protected]> wrote: > Hello all, > > I have 2 routes: > * a file consumer route: that listens for files, validates the file, then > invokes a processing route > * a file processing route: that does further processing on the file. The > processing should NOT affect the file consumer route, therefore, if an > exception happens while processing File-1, I still want the File-1 exchange > to appear complete in the file consumer route (e.g.: move to a completed > subdirectory, per default behavior). > > Since this is a lightweight process, I don't want to use jms/activemq, and > instead have tried async, fire-and-forget, using SEDA. However this does > not seem to be working. > > I've looked thru the docs and the CamelInAction book, and couldn't find > any documentation on this behavior, so it seems unexpected. I've also tried > using the SEDA option: waitForTaskToComplete=Never, but it does not work. > > See the following test: > * the fireForget test using a direct endpoint works as expected > * the fireForget test using the file endpoint FAILS > > --- > public class FileAsyncInOnlyExceptionTest extends CamelTestSupport { > @Test > public void directConsumerShouldNotFailWhe > nSendingFireForgetToViolentAsyncSedaSubRoute() throws Exception { > //when sending msg to direct consumer > String result = invokeRoute("direct", "direct:direct"); > > //then direct is unaffected by boom subRoute > assertEquals("bar", result); > } > > @Test > public void fileConsumerShouldNotFailWhenS > endingFireForgetToViolentAsyncSedaSubRoute() throws Exception { > //given no files exist > File fileStart = new File("file"); > deleteDirectory(fileStart); > assertFileNotExists("file/.error"); > > //when sending msg to file consumer > invokeRoute("file", "file:file"); > > //then file is unaffected by boom subRoute > assertFileNotExists("file/.error"); > } > > private String invokeRoute(String routeId, String endpointUri) { > NotifyBuilder notifyRouteDone = new NotifyBuilder(context). > fromRoute(routeId).whenDone(1).create(); > NotifyBuilder notifyBoom = new NotifyBuilder(context). > fromRoute("boom").whenFailed(1).create(); > > String result = template.requestBody(endpointUri, "foo", > String.class); > > assertTrue("should get the boom", notifyBoom.matches(6, > TimeUnit.SECONDS)); > assertTrue("route should be done", notifyRouteDone.matches(6, > TimeUnit.SECONDS)); > > return result; > } > > > @Override > protected RoutesBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > from("direct:direct").routeId("direct") > .log("hello from direct") > .inOnly("seda:boom") > > .log("goodbye from direct") > .setBody(constant("bar")); > > from("file:file?moveFailed=.error").routeId("file") > .log("hello from file") > .setExchangePattern(ExchangePattern.InOnly) > .inOnly("seda:boom") > > .log("goodbye from file") > .setBody(constant("bar")); > > from("seda:boom").routeId("boom") > .log("hello... evil impending boom") > .delay(2500) > .throwException(new RuntimeException("boom goes > the dynamite")); > } > }; > } > } > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/File-consumer-exchange- > fails-when-async-fire-forget-SEDA-subroute-fails-tp5805390.html > To start a new topic under Camel - Users, email ml+s465427n465428h31@n5. > nabble.com > To unsubscribe from Camel - Users, click here > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=> > . > NAML > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=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/File-consumer-exchange-fails-when-async-fire-forget-SEDA-subroute-fails-tp5805390p5805408.html Sent from the Camel - Users mailing list archive at Nabble.com.
