}
configured = true;
}
protected void sendTimerExchange(long counter) {
final Exchange exchange = endpoint.createExchange();
exchange.setProperty(Exchange.TIMER_COUNTER, counter);
exchange.setProperty(Exchange.TIMER_NAME, endpoint.getTimerName());
exchange.setProperty(Exchange.TIMER_TIME, endpoint.getTime());
exchange.setProperty(Exchange.TIMER_PERIOD, endpoint.getPeriod());
Date now = new Date();
exchange.setProperty(Exchange.TIMER_FIRED_TIME, now);
// also set now on in header with same key as quartz to be consistent
exchange.getIn().setHeader("firedTime", now);
if (LOG.isTraceEnabled()) {
LOG.trace("Timer {} is firing #{} count", endpoint.getTimerName(), counter);
}
if (!endpoint.isSynchronous()) {
getAsyncProcessor().process(exchange, new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// handle any thrown exception
if (exchange.getException() != null) {
getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
}
}
});
} else {
try {
getProcessor().process(exchange);
} catch (Exception e) {
exchange.setException(e);
}
// handle any thrown exception
if (exchange.getException() != null) {
getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
}
}
}