I've hit this in the past and it always confuses me.So I have a route and it multicasts, but for some reason the CamelHttpUri was not set when checking for it in tests. So I tried splitting the two multicast targets into their own routes.
This results in the errororg.apache.camel.FailedToStartRouteException: Failed to start route route23 because of Multiple consumers for the same endpoint is not allowed: direct://versionIndex
If I switch the nodeIndex and versionIndex route blocks around in the code (not the order in the to() call), then direct://nodeIndex appears in the error which makes me think it is in the calling route.
But I'm not sure what else to do?
from(config.getNodeIndex())
.routeId("FcrepoIndexerNode")
// Parse the event into a POJO.
.unmarshal().json(JsonLibrary.Jackson, AS2Event.class)
// Extract relevant data from the event.
.setProperty("event").simple("${body}")
.setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}")
.setProperty("jsonldUrl").simple("${exchangeProperty.event.object.getJsonldUrl().href}")
.setProperty("fedoraBaseUrl").simple("${exchangeProperty.event.target}")
.log(DEBUG, LOGGER, "Received Node event for UUID
(${exchangeProperty.uuid}), jsonld URL (" +
"${exchangeProperty.jsonldUrl}), fedora base
URL (${exchangeProperty.fedoraBaseUrl})")
// Prepare the message.
.removeHeaders("*", "Authorization")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader("Content-Location",
simple("${exchangeProperty.jsonldUrl}"))
.setHeader(config.getFedoraUriHeader(),
exchangeProperty("fedoraBaseUrl"))
.setBody(simple("${null}"))
// Prepare the message.
.removeHeaders("*", "Authorization")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader("Content-Location",
simple("${exchangeProperty.jsonldUrl}"))
.setHeader(config.getFedoraUriHeader(),
exchangeProperty("fedoraBaseUrl"))
.setBody(simple("${null}"))
.multicast().parallelProcessing()
.to("direct:versionIndex", "direct:nodeIndex")
.end();
from("direct:versionIndex")
.filter(simple("${exchangeProperty.event.object.isNewVersion}"))
//pass it to milliner
.log(DEBUG, LOGGER, "Create a new version")
.setHeader(Exchange.HTTP_URI,
simple(config.getMillinerBaseUrl() +
"node/${exchangeProperty.uuid}/version"))
.toD("http://localhost?connectionClose=true");
from("direct:nodeIndex")
.log(DEBUG, LOGGER, config.getMillinerBaseUrl() +
"node/${exchangeProperty.uuid}?connectionClose=true")
.setHeader(Exchange.HTTP_URI,
simple(config.getMillinerBaseUrl() +
"node/${exchangeProperty.uuid}"))
.toD("http://localhost?connectionClose=true");
I've tried changing the ".end()" to ".endParent()" and even removing it,
I've tried removing one of the endpoints from the to() and I tried
removing the "multicast" and see if it works as a pipeline but the error
always occurs.
Any help appreciated. Cheers, jared -- Jared Whiklo [email protected]
OpenPGP_signature
Description: OpenPGP digital signature
