@Override public Producer createProducer() throws Exception { return new DefaultProducer(this) { @Override public void process(final Exchange exchange) throws Exception { executor.execute(new Runnable() { @Override public void run() { try { tradeExecutor.execute(exchange.getIn().getMandatoryBody(Message.class)); } catch (Exception e) { log.error("Error during trade execution", e); } } }); } }; }
public Producer createProducer() throws Exception { return new DefaultProducer(this) { public void process(Exchange exchange) throws Exception { onExchange(exchange); } }; }
@Override public Producer createProducer() throws Exception { return new DefaultProducer(this) { @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader("username", getUsername()); exchange.getIn().setHeader("password", getPassword()); exchange.getIn().setHeader("lines", getLines()); } }; }
@Override public Producer createProducer() throws Exception { return new DefaultProducer(this) { @Override public void process(Exchange exchange) throws Exception { throw new IllegalArgumentException("Forced"); } }; }
public Producer createProducer() throws Exception { ObjectHelper.notNull(applicationContext, "applicationContext"); return new DefaultProducer(this) { public void process(Exchange exchange) throws Exception { ApplicationEvent event = toApplicationEvent(exchange); applicationContext.publishEvent(event); } }; }
@Override protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception { final String value = String.class.cast(parameters.remove("value")); return new DefaultEndpoint() { @Override protected String createEndpointUri() { return uri; } @Override public Producer createProducer() throws Exception { return new DefaultProducer(this) { @Override public void process(final Exchange exchange) throws Exception { exchange.getIn().setBody(exchange.getIn().getBody(String.class) + value); } }; } @Override public Consumer createConsumer(final Processor processor) throws Exception { throw new UnsupportedOperationException(); } @Override public boolean isSingleton() { return true; } }; }