Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10733

camel-cdi - Allow to @Inject a ConsumerTemplate

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Invalid
    • Affects Version/s: 2.18.1
    • Fix Version/s: None
    • Component/s: camel-cdi
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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

      @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);
          }
      
      }
      

      Will fail due the consumer template cannot be injected from CDI

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                antonin.stefanutti Antonin Stefanutti
                Reporter:
                davsclaus Claus Ibsen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: