@Override public boolean process(final Exchange exchange, final AsyncCallback callback) { return processor.process(exchange, callback); }
public Object call() throws Exception { camelProcessor.process(camelExchange, new AsyncCallback() { public void done(boolean doneSync) { // result processing done by onFailure/onSuccess methods } }); return null; } });
@Override public boolean process(final Exchange exchange, final AsyncCallback callback) { return processor.process(exchange, callback); }
AsyncProcessor ap = new AsyncProcessor(p1); ap.process(); //executed asynchronously Proccessor p2 = new Processor(); p2.process(); //executed synchronously
private void processAsynchronously(final Exchange exchange, final ChannelHandlerContext ctx, final Object message) { consumer.getAsyncProcessor().process(exchange, new AsyncCallback() { @Override public void done(boolean doneSync) { // send back response if the communication is synchronous try { if (consumer.getConfiguration().isSync()) { sendResponse(message, ctx, exchange); } } catch (Throwable e) { consumer.getExceptionHandler().handleException(e); } finally { consumer.doneUoW(exchange); } } }); }
@Override public boolean process(final Exchange exchange, final AsyncCallback callback) { LOG.debug("Setting current processor defintion '" + definition.getId() + "'"); exchange.setProperty(CURRENT_PROCESSOR_DEFINITION, definition); return processor.process(exchange, callback); } };
public void sendNotDeliveredMessage(List<String> failedConnectionKeys, Object message) { final Exchange exchange = getEndpoint().createExchange(); // set header and body exchange.getIn().setHeader(WebsocketConstants.CONNECTION_KEY_LIST, failedConnectionKeys); exchange.getIn().setHeader(WebsocketConstants.ERROR_TYPE, WebsocketConstants.MESSAGE_NOT_SENT_ERROR_TYPE); exchange.getIn().setBody(message); // send exchange using the async routing engine getAsyncProcessor().process(exchange, new AsyncCallback() { public void done(boolean doneSync) { if (exchange.getException() != null) { getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException()); } } }); }
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 } }); }
public void sendMessage(final String connectionKey, Object message) { final Exchange exchange = getEndpoint().createExchange(); // set header and body exchange.getIn().setHeader(WebsocketConstants.CONNECTION_KEY, connectionKey); exchange.getIn().setBody(message); // send exchange using the async routing engine getAsyncProcessor().process(exchange, new AsyncCallback() { public void done(boolean doneSync) { if (exchange.getException() != null) { getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException()); } } }); }
@Override public void receive(Message message) { Exchange exchange = endpoint.createExchange(message); try { LOG.debug("Processing message: {}", message); 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 message " + message, e); } }
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 } }); }
@Override public boolean process(Exchange exchange, AsyncCallback callback) { if (breadcrumbs.isEnabled(exchange)) { Set<String> breadcrumbs = Breadcrumbs.getBreadcrumbs(exchange); breadcrumbs.add(exchange.getExchangeId()); } return processor.process(exchange, callback); }
@Override public boolean process(Exchange exchange, AsyncCallback callback) { if (breadcrumbs.isEnabled(exchange)) { Set<String> breadcrumbs = Breadcrumbs.getBreadcrumbs(exchange); breadcrumbs.add(exchange.getExchangeId()); } return processor.process(exchange, callback); }
private boolean processExchange(final Exchange exchange) throws Exception { taskProcessor.process(exchange); final Processor currentProcessor = getProcessor(); if (currentProcessor instanceof AsyncProcessor) { ((AsyncProcessor) currentProcessor).process(exchange, new AsyncCallback() { @Override public void done(boolean doneSync) { // we are not interested in this event } }); } else { currentProcessor.process(exchange); } return true; }
protected void performWrite(final DataValue value) { final Exchange exchange = getEndpoint().createExchange(); exchange.setIn(mapToMessage(value)); try { getAsyncProcessor().process(exchange); } catch (final Exception e) { throw new RuntimeException(e); } }
private void handleValueUpdate(final DataValue value) { final Exchange exchange = getEndpoint().createExchange(); exchange.setIn(mapMessage(value)); try { getAsyncProcessor().process(exchange); } catch (final Exception e) { LOG.debug("Failed to process message", e); } }
@Override protected int poll() throws Exception { Exchange exchange = super.getEndpoint().createExchange(); try { LOG.trace("Retrieving a message"); retrieveMessage(exchange); super.getAsyncProcessor().process(exchange); return 1; } catch (StorageException ex) { if (404 == ex.getHttpStatusCode()) { return 0; } else { throw ex; } } }
@Override protected int poll() throws Exception { Exchange exchange = super.getEndpoint().createExchange(); try { LOG.trace("Getting the blob content"); getBlob(exchange); super.getAsyncProcessor().process(exchange); return 1; } catch (StorageException ex) { if (404 == ex.getHttpStatusCode()) { return 0; } else { throw ex; } } }
private boolean doSend(Exchange exchange, AsyncCallback callback) { ExecutorService executorService = this.executor; if (executorService != null && this.isRunAllowed()) { executorService.execute(() -> this.getAsyncProcessor().process(exchange, doneSync -> { if (exchange.getException() != null) { getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException()); } callback.done(doneSync); })); return false; } else { LOG.warn("Consumer not ready to process exchanges. The exchange {} will be discarded", exchange); callback.done(true); return true; } }
private boolean doSend(Exchange exchange, AsyncCallback callback) { if (isRunAllowed()) { getAsyncProcessor().process(exchange, doneSync -> { if (exchange.getException() != null) { getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException()); } callback.done(doneSync); }); return false; } else { LOG.warn("Consumer not ready to process exchanges. The exchange {} will be discarded", exchange); callback.done(true); return true; } } }