camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkorab <jakub.ko...@gmail.com>
Subject Invalid endpoint on recipient list
Date Tue, 22 Jan 2013 22:06:13 GMT
Hi,

I am going through the recipient list pattern and am trying to work out what
constitutes an "invalid endpoint". Given the following RouteBuilder:

public class RecipientListUnrecognizedEndpointRouteBuilder extends
RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("direct:in")
           
.setHeader("multicastTo").constant("direct:first,direct:second,direct:cheese")
            .recipientList().header("multicastTo").ignoreInvalidEndpoints();

        from("direct:first").to("mock:first");

        from("direct:second").to("mock:second");
    }
}

I would expect that if I send a message to "direct:in", the pattern would
not throw an exception when it reaches the "direct:cheese" endpoint, but it
does. 

org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: Message to be distributed via
recipientList]
...
Caused by: org.apache.camel.CamelExchangeException: No consumers available
on endpoint: Endpoint[direct://cheese]. Exchange[Message: Message to be
distributed via recipientList]
...

Test below.

public class RecipientListUnrecognizedEndpointTest extends CamelTestSupport
{

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RecipientListUnrecognizedEndpointRouteBuilder();
    }

    @Produce(uri = "direct:in")
    protected ProducerTemplate template;

    @EndpointInject(uri = "mock:first")
    private MockEndpoint first;

    @EndpointInject(uri = "mock:second")
    private MockEndpoint second;

    @Test
    public void testMessageRoutedToMulticastEndpoints() throws
InterruptedException {
        String messageBody = "Message to be distributed via recipientList";

        first.setExpectedMessageCount(1);
        first.message(0).equals(messageBody);
        second.setExpectedMessageCount(1);
        second.message(0).equals(messageBody);

        template.sendBody(messageBody);

        assertMockEndpointsSatisfied();
    }

} 

>From my reading of the wiki, and the Camel unit tests, the pattern only
determines that an endpoint is invalid if the component named is
unrecognized, whereas here it's a question of no consumers being available
on the endpoint. Is the use case that I have outlined something that ought
to be handled by the EIP?

Cheers,

Jakub




--
View this message in context: http://camel.465427.n5.nabble.com/Invalid-endpoint-on-recipient-list-tp5726030.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message