[
https://issues.apache.org/jira/browse/CAMEL-10733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-10733:
-----------------------------------
Assignee: Antonin Stefanutti
> camel-cdi - Allow to @Inject a ConsumerTemplate
> -----------------------------------------------
>
> Key: CAMEL-10733
> URL: https://issues.apache.org/jira/browse/CAMEL-10733
> Project: Camel
> Issue Type: Improvement
> Components: camel-cdi
> Affects Versions: 2.18.1
> Reporter: Claus Ibsen
> Assignee: Antonin Stefanutti
> Priority: Minor
>
> You can inject a producer template, but not a consumer template. We should
> add support for the latter as well.
> For example a little swarm unit test
> {code}
> @RunWith(Arquillian.class)
> @DefaultDeployment
> public class WildFlySwarmCamelTest {
> @Inject
> private CamelContext camelContext;
> @Inject @Uri("seda:inbox")
> private ProducerTemplate producer;
> @Inject @Uri("seda:outbox")
> private ConsumerTemplate consumer;
> @Test
> public void testSeda() throws Exception {
> // send to the seda inbox queue
> producer.sendBody("Hello Swarm");
> // use 5 second timeout to receive the message from outbox
> Object body = consumer.receiveBody("seda:outbox", 5000);
> // expect it was the message we sent
> assertEquals("Hello Swarm", body);
> }
> }
> {code}
> Will fail due the consumer template cannot be injected from CDI
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)