use of org.apache.camel.AsyncCallback in project camel by apache.
the class CamelEventHandler method doEventReceived.
/**
* Callback executed to propagate event from Guava listener to Camel route.
*
* @param event the event received by Guava EventBus.
*/
public void doEventReceived(Object event) {
log.trace("Received event: {}");
final Exchange exchange = eventBusEndpoint.createExchange(event);
log.debug("Processing event: {}", event);
// use async processor to support async routing engine
processor.process(exchange, new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// noop
}
});
}
use of org.apache.camel.AsyncCallback in project camel by apache.
the class IgniteCacheContinuousQueryConsumer method fireGroupedExchange.
private void fireGroupedExchange(Iterable<CacheEntryEvent<? extends Object, ? extends Object>> events) {
Exchange exchange = createExchange(events);
getAsyncProcessor().process(exchange, new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// do nothing
}
});
}
use of org.apache.camel.AsyncCallback in project camel by apache.
the class IgniteCacheContinuousQueryConsumer method fireSingleExchange.
private void fireSingleExchange(CacheEntryEvent<? extends Object, ? extends Object> entry) {
Exchange exchange = createExchange(entry.getValue());
exchange.getIn().setHeader(IgniteConstants.IGNITE_CACHE_EVENT_TYPE, entry.getEventType());
exchange.getIn().setHeader(IgniteConstants.IGNITE_CACHE_OLD_VALUE, entry.getOldValue());
exchange.getIn().setHeader(IgniteConstants.IGNITE_CACHE_KEY, entry.getKey());
getAsyncProcessor().process(exchange, new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// do nothing
}
});
}
use of org.apache.camel.AsyncCallback in project camel by apache.
the class IgniteCacheContinuousQueryConsumer method maybeFireExistingQueryResults.
private void maybeFireExistingQueryResults() {
if (!endpoint.isFireExistingQueryResults()) {
LOG.info(String.format("Skipping existing cache results for cache name = %s.", endpoint.getCacheName()));
return;
}
LOG.info(String.format("Processing existing cache results for cache name = %s.", endpoint.getCacheName()));
for (Entry<Object, Object> entry : cursor) {
Exchange exchange = createExchange(entry.getValue());
exchange.getIn().setHeader(IgniteConstants.IGNITE_CACHE_KEY, entry.getKey());
getAsyncProcessor().process(createExchange(entry), new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// do nothing
}
});
}
}
use of org.apache.camel.AsyncCallback in project camel by apache.
the class CamelJGroupsReceiver method viewAccepted.
@Override
public void viewAccepted(View view) {
if (endpoint.isEnableViewMessages()) {
Exchange exchange = endpoint.createExchange(view);
try {
LOG.debug("Processing view: {}", view);
processor.process(exchange, new AsyncCallback() {
@Override
public void done(boolean doneSync) {
// noop
}
});
} catch (Exception e) {
throw new JGroupsException("Error in consumer while dispatching exchange containing view " + view, e);
}
} else {
LOG.debug("Option enableViewMessages is set to false. Skipping processing of the view: {}", view);
}
}
Aggregations