My route looks like this:

It takes xml documents from a queue and sends them as payload in a
webservice call, returning the output to a rabbitmq exchange
Does some validationa and extracts some fields used for logging via the
routeEventsObserver

@Override
public void configure() throws Exception {


    errorHandler(defaultErrorHandler()
            .maximumRedeliveries(maxRedeliveries)
            .redeliveryDelay(redeliveryDelay)
            .logNewException(true)
            //.log("XX: Default Error Handler")
            .retryAttemptedLogLevel(LoggingLevel.WARN));



    onException(ValidationException.class, org.xml.sax.SAXParseException.class)
            .handled(true)
            .maximumRedeliveries(0)
            .to(validationErrorsEndpoint);

    from(validationErrorsEndpoint)
            .log(LoggingLevel.ERROR, "Failed calling WS on route " + routeId)
            .bean(routeEventsObserver, "failed")
            .to("bean:errorHandler")
            .process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    logger.debug("XX: Validation Error");
                }
            })
            .to(output);

    from(catchAllErrorsEndpoint)
            .process(new Processor() {
                @Override
                public void process(Exchange exchange) throws
java.lang.Exception {
                    logger.debug("XX: General Error");
                }
            });


    configureDescriptionRoute(descriptionEndpoint);
    ProcessorDefinition pd =
            from(input)


        .routeId(routeId)
        .setExchangePattern(ExchangePattern.InOnly)
        .convertBodyTo(String.class)
        .to("log:dk.jppol.ip.app.adapter.sap?showAll=true")
        .setProperty(BUSINESS_ID, xpath(businessIdXpath, String.class))
        .setProperty(ServiceBusMessageHeaders.TRANSACTION_ID,
header(ServiceBusMessageHeaders.TRANSACTION_ID))
        .bean(routeEventsObserver, "initiated")
        .to(descriptionEndpoint)
        .bean(TransactionIdValidator.class)
        .to("validator:" + schema);

        if (preProcessingUrl != null) {
            pd.to(preProcessingUrl);
        }

        pd

        .log("Calling SAP from " + routeId)
        .to(cxfBean)
            .convertBodyTo(String.class)
        .choice()
            .when(xpath(Xpath.XPATH_ERROR))
                .setProperty(SAP_ERROR,
xpath(Xpath.XPATH_ERROR_NUMBER).stringResult())
                .setProperty(SAP_MESSAGE,
xpath(Xpath.XPATH_MESSAGE).stringResult())
                .bean(routeEventsObserver, "error")
            .otherwise()
                .bean(routeEventsObserver, "finished")
        .end()
        .to("bean:prepareOutputService")
        .log("Received response from SAP on route " + routeId)
        .to(output);

}



2016-09-15 16:48 GMT+02:00 souciance <souciance.eqdam.ras...@gmail.com>:

> Everything looks ok, can you share your route?
>
> On Thu, Sep 15, 2016 at 12:05 PM, stefanmeisner [via Camel] <
> ml-node+s465427n5787594...@n5.nabble.com> wrote:
>
> >
> > Connection factory:
> >
> >     <bean id="rabbitMqConnectionFactory" class="com.rabbitmq.client.
> > ConnectionFactory">
> >         <property name="uri" value="amqp://sb:xxx...@lb.mq-
> > test.jppol.net:5672/servicebus"/>
> >     </bean>
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/Camel-route-stops-
> > consuming-from-RabbitMQ-queue-tp5787591p5787594.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@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=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > 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/Camel-route-stops-consuming-from-RabbitMQ-queue-tp5787591p5787606.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to