camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aturkin <>
Subject Apache camel. InterceptSendTo doesn't work with bean endpoint
Date Tue, 22 Mar 2016 11:14:03 GMT
I can't understand why my tests don't work. I try intercept and skip sending
to endpoint which is bean reference and nothing happens. I'm using version


<bean id="eb" class="com.rencap.emf.bpipe.EndpointBean"/>    
<camel:camelContext xmlns="">  
    <camel:endpoint id="requestEP" uri="direct:request"/>
    <endpoint id="beanEP" uri="bean:eb?method=processMessage" />
    <camel:route id="testRoute">
        <camel:from ref="requestEP"/>
        <camel:to ref="sendEP" />

package com.rencap.emf.bpipe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EndpointBean {
    private static Logger LOG = LoggerFactory.getLogger(EndpointBean.class);

    public void processMessage( String msg ){"Processing message: {} ",msg);
Unit test:

ProducerTemplate requestEP;
ProducerTemplate beanEP;
ModelCamelContext camelContext; 
public void test() throws Exception{

    camelContext.getRouteDefinition("testRoute").adviceWith( camelContext ,
new AdviceWithRouteBuilder(){
        public void configure() throws Exception {
beanEP.getDefaultEndpoint().getEndpointUri() ).
    TestUtils.waitingFor("Configuration applied", 2000);

    MockEndpoint mockEP =
    mockEP.setExpectedCount( 1 );



    TestUtils.waitingFor("All rows commited", 2000);
Test always fails. Logs:

13:11:02.512 [main] INFO  o.apache.camel.model.RouteDefinition - AdviceWith
route after: Route(testRoute)[[From[ref:requestEP]] ->
[InterceptSendToEndpoint[bean://eb?method=processMessage ->
[To[mock:send]]], To[ref:beanEP]]]
13:11:02.537 [main] INFO  o.a.camel.spring.SpringCamelContext - Route:
testRoute started and consuming from: Endpoint[direct://request]
13:11:02.538 [main] INFO  com.rencap.emf.bpipe.test.TestUtils - Wait 2000
ms. Configuration applied 
13:11:04.554 [main] INFO  com.rencap.emf.bpipe.EndpointBean - Processing
message: Message 
13:11:04.556 [main] INFO  o.a.c.component.mock.MockEndpoint - Asserting:
Endpoint[mock://send] is satisfied
It means that sending to endpoint isn't being intercepted and skipped. May
be I don't understand something but I coudn't find any restriction on use
this method.

In additional I noticed the same problem for endpoint with log. If I replace
beanEP on :

<endpoint id="beanEP" uri="log:LOGMESSAGE" />
that I receive the same result. But if I replace it on

<endpoint id="beanEP" uri="seda:send" />
and add new route :

<camel:route id="route2">
        <camel:from ref="sendEP"/>
        <camel:log message="msg received ${body}"/>
that I will get expected result and test will be successed.

What do I do wrong? Or maybe Are there some restrictions on this method?

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message