Tabnine Logo
ConsumerTemplate
Code IndexAdd Tabnine to your IDE (free)

How to use
ConsumerTemplate
in
org.apache.camel

Best Java code snippets using org.apache.camel.ConsumerTemplate (Showing top 17 results out of 315)

origin: deeplearning4j/nd4j

/**
 * Receive an ndarray
 * @return
 */
public INDArray receive() {
  if (consumerTemplate == null)
    consumerTemplate = camelContext.createConsumerTemplate();
  return consumerTemplate.receiveBody("direct:receive", INDArray.class);
}
origin: jooby-project/jooby

@PreDestroy
public void stop() throws Exception {
 try {
  this.consumer.stop();
 } catch (Exception ex) {
  log.error("Can't stop consumer template", ex);
 }
 try {
  this.producer.stop();
 } catch (Exception ex) {
  log.error("Can't stop producer template", ex);
 }
 try {
  this.ctx.stop();
 } catch (Exception ex) {
  log.error("Can't stop camel context template", ex);
 }
}
origin: jooby-project/jooby

@PostConstruct
public void start() throws Exception {
 this.ctx.start();
 this.producer.start();
 this.consumer.start();
}
origin: mpilone/hazelcastmq

  receiveBody("hazelcastmq:queue:primo.test", 2000, String.class);
consumerTemplate.stop();
camelContext.stop();
origin: io.codearte.accurest/accurest-messaging-camel

@Override
@SuppressWarnings("unchecked")
public AccurestMessage<T, Message> receiveMessage(String destination, long timeout, TimeUnit timeUnit) {
  try {
    ConsumerTemplate consumerTemplate = context.createConsumerTemplate();
    Exchange exchange = consumerTemplate.receive(destination, timeUnit.toMillis(timeout));
    return builder.create(exchange.getIn());
  } catch (Exception e) {
    log.error("Exception occurred while trying to read a message from " +
        " a channel with name [" + destination + "]", e);
    throw new RuntimeException(e);
  }
}
origin: com.consol.citrus/citrus-camel

@Override
public void send(Message message, TestContext context) {
  Assert.notNull(message, "Message is empty - unable to send empty message");
  String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
  String correlationKey = correlationManager.getCorrelationKey(correlationKeyName, context);
  Exchange exchange = correlationManager.find(correlationKey, endpointConfiguration.getTimeout());
  Assert.notNull(exchange, "Failed to find camel exchange for message correlation key: '" + correlationKey + "'");
  buildOutMessage(exchange, message);
  if (log.isDebugEnabled()) {
    log.debug("Sending reply message to camel endpoint: '" + exchange.getFromEndpoint() + "'");
  }
  getConsumerTemplate().doneUoW(exchange);
  context.onOutboundMessage(message);
  log.info("Message was sent to camel endpoint: '" + exchange.getFromEndpoint() + "'");
}
origin: com.consol.citrus/citrus-camel

@Override
public Message receive(TestContext context, long timeout) {
  if (log.isDebugEnabled()) {
    log.debug("Receiving message from camel endpoint: '" + endpointConfiguration.getEndpointUri() + "'");
  }
  Exchange exchange = getConsumerTemplate().receive(endpointConfiguration.getEndpointUri(), timeout);
  if (exchange == null) {
    throw new ActionTimeoutException("Action timed out while receiving message from camel endpoint '" + endpointConfiguration.getEndpointUri() + "'");
  }
  log.info("Received message from camel endpoint: '" + endpointConfiguration.getEndpointUri() + "'");
  Message message = endpointConfiguration.getMessageConverter().convertInbound(exchange, endpointConfiguration, context);
  context.onInboundMessage(message);
  return message;
}
origin: camelinaction/camelinaction

  public String getOrders() {
    String order = "";
    String orders = "";

    while (order != null) {
      order = consumer.receiveBody("activemq:orders", 1000, String.class);
      if (order != null) {
        orders = orders + "," + order;
      }
    }
    return orders;
  }
}
origin: org.apache.camel/camel-test

private static void doStopTemplates(ConsumerTemplate consumer, ProducerTemplate template, FluentProducerTemplate fluentTemplate) throws Exception {
  if (consumer != null) {
    if (consumer == threadConsumer.get()) {
      threadConsumer.remove();
    }
    consumer.stop();
  }
  if (template != null) {
    if (template == threadTemplate.get()) {
      threadTemplate.remove();
    }
    template.stop();
  }
  if (fluentTemplate != null) {
    if (fluentTemplate == threadFluentTemplate.get()) {
      threadFluentTemplate.remove();
    }
    fluentTemplate.stop();
  }
}
origin: org.apache.camel/camel-test

fluentTemplate.start();
consumer = context.createConsumerTemplate();
consumer.start();
origin: com.consol.citrus/citrus-camel

@Override
public Message receive(TestContext context, long timeout) {
  if (log.isDebugEnabled()) {
    log.debug("Receiving message from camel endpoint: '" + endpointConfiguration.getEndpointUri() + "'");
  }
  Exchange exchange = getConsumerTemplate().receive(endpointConfiguration.getEndpointUri(), timeout);
  if (exchange == null) {
    throw new ActionTimeoutException("Action timed out while receiving message from camel endpoint '" + endpointConfiguration.getEndpointUri() + "'");
  }
  log.info("Received message from camel endpoint: '" + endpointConfiguration.getEndpointUri() + "'");
  Message message = endpointConfiguration.getMessageConverter().convertInbound(exchange, endpointConfiguration, context);
  context.onInboundMessage(message);
  String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
  String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(message);
  correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
  correlationManager.store(correlationKey, exchange);
  return message;
}
origin: org.apache.batchee/batchee-camel

public static Object receive(final String locator, final String endpoint, final long timeout, final Class<?> expected) {
  final BeanLocator.LocatorInstance<CamelTemplateLocator> locatorInstance = locator(locator);
  try {
    final ConsumerTemplate consumerTemplate = locatorInstance.getValue().findConsumerTemplate();
    if (timeout > 0) {
      if (expected != null) {
        return consumerTemplate.receiveBody(endpoint, expected);
      }
      return consumerTemplate.receiveBody(endpoint);
    }
    if (expected != null) {
      return consumerTemplate.receiveBody(endpoint, timeout, expected);
    }
    return consumerTemplate.receiveBody(endpoint, timeout);
  } finally {
    locatorInstance.release();
  }
}
origin: org.jooby/jooby-camel

@PreDestroy
public void stop() throws Exception {
 try {
  this.consumer.stop();
 } catch (Exception ex) {
  log.error("Can't stop consumer template", ex);
 }
 try {
  this.producer.stop();
 } catch (Exception ex) {
  log.error("Can't stop producer template", ex);
 }
 try {
  this.ctx.stop();
 } catch (Exception ex) {
  log.error("Can't stop camel context template", ex);
 }
}
origin: org.jooby/jooby-camel

@PostConstruct
public void start() throws Exception {
 this.ctx.start();
 this.producer.start();
 this.consumer.start();
}
origin: stackoverflow.com

from(URI_WEBSERVICE)
     .convertBodyTo(Entrada.class)
     .process(new Processor() {
       @Override
       public void process(Exchange exchange) throws Exception {
         // logic of ProcessorTratarWS goes here
         ConsumerTemplate consumer=exchange.getContext().createConsumerTemplate();
         String filename=exchange.getProperty("archivoRespuesta",String.class);                  
         Object file=consumer.receiveBody("ftp://10.100.8.2/entradaCamel?username=USER&password=PASSWORD&delete=true&fileName="+filename,timeOut);
         // logic of EstrategiaConfirmacion goes here
     }
   })
   .to(WS_RESPONDER);
origin: io.rhiot/rhiot-cloudplatform-connector

public <T> T pollChannel(String channel, Class<T> responseType) {
  byte[] busResponse = producerTemplate.getCamelContext().createConsumerTemplate().receiveBody("amqp:" + channel, byte[].class);
  return decodedPayload(busResponse, responseType);
}
origin: stackoverflow.com

List data = (List<Person>)ct.receiveBody("seda:foo", 5000);
org.apache.camelConsumerTemplate

Most used methods

  • receiveBody
  • stop
  • receive
  • start
  • doneUoW

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now