use of org.apache.camel.Consumer in project camel by apache.
the class TimerEndpoint method createConsumer.
public Consumer createConsumer(Processor processor) throws Exception {
Consumer answer = new TimerConsumer(this, processor);
configureConsumer(answer);
return answer;
}
use of org.apache.camel.Consumer in project camel by apache.
the class SedaEndpoint method createConsumer.
public Consumer createConsumer(Processor processor) throws Exception {
if (getComponent() != null) {
// all consumers must match having the same multipleConsumers options
String key = getComponent().getQueueKey(getEndpointUri());
QueueReference ref = getComponent().getQueueReference(key);
if (ref != null && ref.getMultipleConsumers() != isMultipleConsumers()) {
// there is already a multiple consumers, so make sure they matches
throw new IllegalArgumentException("Cannot use existing queue " + key + " as the existing queue multiple consumers " + ref.getMultipleConsumers() + " does not match given multiple consumers " + multipleConsumers);
}
}
Consumer answer = createNewConsumer(processor);
configureConsumer(answer);
return answer;
}
use of org.apache.camel.Consumer in project camel by apache.
the class CamelPostProcessorHelper method subscribeMethod.
public void subscribeMethod(Method method, Object bean, String beanName, String endpointUri, String endpointName, String endpointProperty) {
// lets bind this method to a listener
String injectionPointName = method.getName();
Endpoint endpoint = getEndpointInjection(bean, endpointUri, endpointName, endpointProperty, injectionPointName, true);
if (endpoint != null) {
try {
Processor processor = createConsumerProcessor(bean, method, endpoint);
Consumer consumer = endpoint.createConsumer(processor);
LOG.debug("Created processor: {} for consumer: {}", processor, consumer);
startService(consumer, endpoint.getCamelContext(), bean, beanName);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
}
use of org.apache.camel.Consumer in project camel by apache.
the class IgniteMessagingTest method testConsumerManyMessages.
@Test
public void testConsumerManyMessages() throws Exception {
List<Object> messages = Lists.newArrayList();
Consumer consumer = context.getEndpoint("ignite:messaging:TOPIC1").createConsumer(storeBodyInListProcessor(messages));
consumer.start();
Set<Integer> messagesToSend = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers());
ignite().message().send(TOPIC1, messagesToSend);
await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100));
consumer.stop();
}
use of org.apache.camel.Consumer in project camel by apache.
the class Jt400Endpoint method createConsumer.
@Override
public Consumer createConsumer(Processor processor) throws Exception {
if (Jt400Type.DTAQ == configuration.getType()) {
Consumer consumer = new Jt400DataQueueConsumer(this, processor);
configureConsumer(consumer);
return consumer;
} else {
throw new OperationNotSupportedException();
}
}
Aggregations