use of org.apache.camel.Consumer in project camel by apache.
the class SedaEndpointTest method testSedaEndpointSetQueue.
public void testSedaEndpointSetQueue() throws Exception {
SedaEndpoint seda = new SedaEndpoint();
assertNotNull(seda);
seda.setCamelContext(context);
seda.setEndpointUriIfNotSpecified("seda://bar");
assertNotNull(seda.getQueue());
// overwrite with a new queue
seda.setQueue(new ArrayBlockingQueue<Exchange>(1000));
seda.setConcurrentConsumers(2);
assertEquals(1000, seda.getSize());
assertNotSame(queue, seda.getQueue());
assertEquals(2, seda.getConcurrentConsumers());
Producer prod = seda.createProducer();
seda.onStarted((SedaProducer) prod);
assertEquals(1, seda.getProducers().size());
Consumer cons = seda.createConsumer(new Processor() {
public void process(Exchange exchange) throws Exception {
// do nothing
}
});
seda.onStarted((SedaConsumer) cons);
assertEquals(1, seda.getConsumers().size());
assertEquals(0, seda.getExchanges().size());
}
Aggregations