use of org.apache.camel.RuntimeExchangeException in project camel by apache.
the class CdiEventConsumer method notify.
void notify(T event) {
logger.debug("Consuming CDI event [{}] with {}", event, this);
Exchange exchange = getEndpoint().createExchange();
// TODO: would that be possible to propagate the event metadata?
exchange.getIn().setBody(event);
// Avoid infinite loop of exchange events
if (event instanceof AbstractExchangeEvent) {
exchange.setProperty(Exchange.NOTIFY_EVENT, Boolean.TRUE);
}
try {
getProcessor().process(exchange);
} catch (Exception cause) {
throw new RuntimeExchangeException("Error while processing CDI event", exchange, cause);
} finally {
if (event instanceof AbstractExchangeEvent) {
exchange.setProperty(Exchange.NOTIFY_EVENT, Boolean.FALSE);
}
}
}
Aggregations