You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Antonin Stefanutti (JIRA)" <ji...@apache.org> on 2017/03/03 11:04:45 UTC
[jira] [Commented] (CAMEL-10733) camel-cdi - Allow to @Inject a
ConsumerTemplate
[ https://issues.apache.org/jira/browse/CAMEL-10733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15894151#comment-15894151 ]
Antonin Stefanutti commented on CAMEL-10733:
--------------------------------------------
I think it's already possible with CAMEL-9811. As there is no concept of default URI nor endpoint for {{ConsumerTemplate}}, injection point must be declared without the {{@Uri}} qualifier, e.g.:
{code}
@Inject
ConsumerTemplate template;
{code}
> 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)