public String getExchangeId() { return exchange.getExchangeId(); }
public void done(boolean doneSync) { if (!doneSync) { log.trace("Asynchronous callback received for exchangeId: {}", exchange.getExchangeId()); latch.countDown(); } }
if (!sync) { log.trace("Waiting for asynchronous callback before continuing for exchangeId: {} -> {}", exchange.getExchangeId(), exchange); try { latch.await(); exchange.getExchangeId(), exchange);
public void done(boolean doneSync) { // make sure the continuation resume will not be called before the suspend method in other thread synchronized (continuation) { LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId()); // resume processing after both, sync and async callbacks continuation.resume(); } } });
@Override public void remove(CamelContext camelContext, String key, Exchange exchange) { LOG.trace("Removing an exchange with ID {} for key {}", exchange.getExchangeId(), key); cache.remove(key); }
@Override public void onExchangeBegin(Route route, Exchange exchange) { if (tracker == null) { return; } exchange.setProperty(IntegrationLoggingConstants.ACTIVITY_ID, exchange.getExchangeId()); tracker.track( "exchange", exchange.getExchangeId(), "status", "begin" ); }
@Override public void remove(CamelContext camelContext, String key, Exchange exchange) { LOG.trace("Removing an exchange with ID {} for key {}", exchange.getExchangeId(), key); cache.remove(key); }
public void done(boolean doneSync) { // make sure the continuation resume will not be called before the suspend method in other thread synchronized (continuation) { LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId()); // resume processing after both, sync and async callbacks continuation.resume(); } } });
@Override public void onExchangeBegin(Route route, Exchange exchange) { super.onExchangeBegin(route, exchange); LOG.info("Exchange Begin for route " + route.getId() + " exchange: " + exchange.getExchangeId()); }
@Override public void onExchangeDone(Route route, Exchange exchange) { System.out.println(toJsonObject( "exchange", exchange.getExchangeId(), "status", "done", "failed", exchange.isFailed())); } };
/** * Find all routes that have been passed by this exchange object and set their status * to successful. * @param exchange the exchange object that completed its processing by this app. */ private void markRouteExecutionsAsCompleted(Exchange exchange) { List<RouteExecution> routeCompletions = routeExecutionStore.executionsForExchange(exchange.getExchangeId()); routeCompletions.forEach(r -> r.setState(RouteExchangeState.OK)); }
/** * Marks all route executions before the error occurred as failed. */ private void markAllRouteExecutionAsFailed(Exchange exchange) { List<RouteExecution> routeExecutions = routeExecutionStore.executionsForExchange(exchange.getExchangeId()); routeExecutions.forEach(r -> r.setState(RouteExchangeState.FAILED)); }
/** * Marks only the route where the error occurred as failed */ private void markRouteExecutionAsFailed(Exchange exchange) { List<RouteExecution> routeExecutions = routeExecutionStore.executionsForExchange(exchange.getExchangeId()); String failureRouteId = exchange.getProperty(Exchange.FAILURE_ROUTE_ID).toString(); routeExecutions.stream() .filter(r -> r.routeId().equals(failureRouteId)) .findFirst().get().setState(RouteExchangeState.FAILED); }
@Override public void onExchangeDone(Route route, Exchange exchange) { super.onExchangeDone(route, exchange); LOG.info("Exchange Done for route " + route.getId() + " exchange: " + exchange.getExchangeId() + " in: " + exchange.getIn().getBody(String.class)); stopCurrentRouteAsync(route); }
@Override public Exchange add(CamelContext camelContext, String key, Exchange exchange) { if (optimistic) { throw new UnsupportedOperationException(); } LOG.trace("Adding an Exchange with ID {} for key {} in a thread-safe manner.", exchange.getExchangeId(), key); DefaultExchangeHolder newHolder = DefaultExchangeHolder.marshal(exchange, true, allowSerializedHeaders); DefaultExchangeHolder oldHolder = cache.getAndPut(key, newHolder); return unmarshallExchange(camelContext, oldHolder); }
@Override public void done(boolean doneSync) { ed.start(stats); try { callback.done(doneSync); } finally { if (ed.stop(stats)) { exchanges.remove(exchange.getExchangeId()); } } } });
@Override public Exchange add(final CamelContext camelContext, final String key, final Exchange exchange) { LOG.trace("Adding an Exchange with ID {} for key {} in a thread-safe manner.", exchange.getExchangeId(), key); DefaultExchangeHolder newHolder = DefaultExchangeHolder.marshal(exchange, true, allowSerializedHeaders); DefaultExchangeHolder oldHolder = cache.put(key, newHolder); return unmarshallExchange(camelContext, oldHolder); }
public void notify(EventObject eventObject) throws Exception { if (eventObject instanceof ExchangeFailedEvent) { ExchangeFailedEvent event = (ExchangeFailedEvent) eventObject; String id = event.getExchange().getExchangeId(); Exception cause = event.getExchange().getException(); Date now = new Date(); publisher.publish(appId, id, now, cause.getMessage()); } }
public void process(Exchange exchange, String message) { if (getLogger().shouldLog()) { getLogger().log(formatter.format(exchange) + message); } LOGGER.warn("An unexpected exception while processing exchange " + exchange.getExchangeId() + " has occured: " + message); publish(exchange); }
private void digestProcessorRedeliveryEvent(AuditEvent ev) { DBObject filter = new BasicDBObject("_id", ev.getBreadCrumbId()); // we don't know what processor caused it, because this info is not on the event, so just push an element into the processorRedeliveries array for the time being DBObject toPush = BasicDBObjectBuilder.start() .push("$push") .push("processorRedeliveries") .append("exchangeId", ev.getExchange().getExchangeId()) .append("timestamp", ev.getTimestamp()) .append("exception", ev.getException().toString()) .append("attempt", ev.getExchange().getProperty(Exchange.REDELIVERY_COUNTER)).get(); collectionFor(ev).update(filter, toPush); }