Frage

We are using Camel fluent builders to set up a series of complex routes, in which we are using dynamic routing using the RecipientList functionality.

We've encountered issues where in some cases, the recipient list contains a messaging endpoint that doesn't exist (for example, something like seda:notThere).

A simple example is something like this:

from("seda:SomeSource")....to("seda:notThere");

How can I configure the route so that if the exchange tries to route to an endpoint that doesn't already exist, an error is thrown?

I'm using Camel 2.9.x, and I've already experimented with the Dead Letter Channel and various Error Handler implementations, with (seemingly) no errors or warnings logged.

The only logging I see indicates that Camel is (attempting to) send to the endpoint which doesn't exist:

2013-07-03 16:07:08,030|main|DEBUG|o.a.c.p.SendProcessor|>>>> Endpoint[seda://notThere] Exchange[Message: x.y.Z@293b9fae]

Thanks in advance!

War es hilfreich?

Lösung

All endpoints behave differently in this case.

If you attempt to write to a ftp server that does not exist, you certainly get an error (connection refused or otherwise)..

This is also true for a number of endpoints.

SEDA queues gets created if the do not exist and the message will be left there. So your route actually sends to "notThere" and the message will still be there until the application restarts or someone starts to consume messages from seda:notThere. This is the way seda queues are designed. If you set the size of the seda queue by to("seda:notThere?size=100"), then if there is noone reading (or reading slowly) you will get exceptions on message 101 and forward.

If you need to be sure some route is consuming your messages, use "direct" instead of "seda". You can even have some middle layer to use the features of seda with respect to staging and the features of direct knowing there is a consumer active (if sent from recipient list with perhaps user input (god forbid).

from("whatever").recipentList( ... ); // "direct:ep1" work, "direct:ep2" throws exception

from("direct:ep1").to("seda:ep1");
from("seda:ep1").doRealStagedStuffHere();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top