use of org.apache.camel.management.event.AbstractExchangeEvent in project camel by apache.
the class DebugExceptionEventBreakpointTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
breakpoint = new BreakpointSupport() {
public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
AbstractExchangeEvent aee = (AbstractExchangeEvent) event;
Exception e = aee.getExchange().getException();
logs.add("Breakpoint at " + definition + " caused by: " + e.getClass().getSimpleName() + "[" + e.getMessage() + "]");
}
};
exceptionCondition = new ConditionSupport() {
public boolean matchEvent(Exchange exchange, EventObject event) {
return event instanceof ExchangeFailedEvent;
}
};
}
use of org.apache.camel.management.event.AbstractExchangeEvent 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