private Exchange prepareCopy(final Exchange exchange, final boolean handover) { // use a new copy of the exchange to route async final Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, handover); // set a new from endpoint to be the disruptor copy.setFromEndpoint(endpoint); return copy; } }
private Exchange prepareExchange(final Exchange exchange) { // send a new copied exchange with new camel context // don't copy handovers as they are handled by the Disruptor Event Handlers final Exchange newExchange = ExchangeHelper .copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); // set the from endpoint newExchange.setFromEndpoint(endpoint); return newExchange; }
protected void handleActiveProviderExchange(MessageExchange exchange) throws Exception { // Fault message if (exchange.getFault() != null) { done(exchange); // In message } else if (exchange.getMessage("in") != null) { logger.debug("Received exchange: {}", exchange); final Exchange camelExchange = binding.createExchange(exchange); camelExchange.setFromEndpoint(camelEndpoint); camelExchange.addOnCompletion(this); binding.runWithCamelContextClassLoader(new Callable<Object>() { public Object call() throws Exception { camelProcessor.process(camelExchange, new AsyncCallback() { public void done(boolean doneSync) { // result processing done by onFailure/onSuccess methods } }); return null; } }); } else { // This is not complaint with the default MEPs throw new IllegalStateException("Provider exchange is ACTIVE, but no in or fault is provided"); } }
public Exchange unmarshallExchange(CamelContext camelContext, byte[] buffer) throws IOException, ClassNotFoundException { DefaultExchangeHolder pe = decode(camelContext, buffer); Exchange answer = new DefaultExchange(camelContext); DefaultExchangeHolder.unmarshal(answer, pe); // restore the from endpoint String fromEndpointUri = (String) answer.removeProperty("CamelAggregatedFromEndpoint"); if (fromEndpointUri != null) { Endpoint fromEndpoint = camelContext.hasEndpoint(fromEndpointUri); if (fromEndpoint != null) { answer.setFromEndpoint(fromEndpoint); } } return answer; }
public Exchange unmarshallExchange(CamelContext camelContext, byte[] buffer) throws IOException, ClassNotFoundException { DefaultExchangeHolder pe = decode(buffer); Exchange answer = new DefaultExchange(camelContext); DefaultExchangeHolder.unmarshal(answer, pe); // restore the from endpoint String fromEndpointUri = (String) answer.removeProperty("CamelAggregatedFromEndpoint"); if (fromEndpointUri != null) { Endpoint fromEndpoint = camelContext.hasEndpoint(fromEndpointUri); if (fromEndpoint != null) { answer.setFromEndpoint(fromEndpoint); } } return answer; }
copy.setFromEndpoint(endpoint);
public Exchange unmarshallExchange(CamelContext camelContext, ByteBuffer buffer) throws IOException, ClassNotFoundException { DefaultExchangeHolder pe = (DefaultExchangeHolder) deserialize(new ByteBufferInputStream(buffer)); Exchange answer = new DefaultExchange(camelContext); DefaultExchangeHolder.unmarshal(answer, pe); // restore the from endpoint String fromEndpointUri = (String) answer.removeProperty("CamelAggregatedFromEndpoint"); if (fromEndpointUri != null) { Endpoint fromEndpoint = camelContext.hasEndpoint(fromEndpointUri); if (fromEndpoint != null) { answer.setFromEndpoint(fromEndpoint); } } return answer; }
public Exchange unmarshallExchange(CamelContext camelContext, Buffer buffer) throws IOException { DataByteArrayInputStream bais = new DataByteArrayInputStream(buffer); DefaultExchangeHolder pe = exchangeCodec.decode(bais); Exchange answer = new DefaultExchange(camelContext); DefaultExchangeHolder.unmarshal(answer, pe); // restore the from endpoint String fromEndpointUri = (String) answer.removeProperty("CamelAggregatedFromEndpoint"); if (fromEndpointUri != null) { Endpoint fromEndpoint = camelContext.hasEndpoint(fromEndpointUri); if (fromEndpoint != null) { answer.setFromEndpoint(fromEndpoint); } } return answer; }
Exchange exchange = getEndpoint().createExchange(pattern); exchange.setFromEndpoint(getEndpoint()); exchange.setExchangeId(task.getWorkerId() + "/" + task.getId()); exchange.setProperty(EXCHANGE_HEADER_PROCESS_INSTANCE_ID, task.getProcessInstanceId());
private void onInternalMessageArrived(final String deviceId, final String appTopic, final KuraPayload message, final int qos, final boolean retain, final boolean control) { this.log.debug("Received message with deviceId {}, application topic {}.", deviceId, appTopic); final Exchange exchange = anExchange(getEndpoint().getCamelContext()) // .withBody(message) // .withHeader(CAMEL_KURA_CLOUD_TOPIC, appTopic) // .withHeader(CAMEL_KURA_CLOUD_DEVICEID, deviceId) // .withHeader(CAMEL_KURA_CLOUD_QOS, qos) // .withHeader(CAMEL_KURA_CLOUD_CONTROL, control) // .withHeader(CAMEL_KURA_CLOUD_RETAIN, retain) // .build(); exchange.setFromEndpoint(getEndpoint()); try { getProcessor().process(exchange); } catch (final Exception e) { handleException("Error while processing an incoming message:", e); } }