Using amq with java camel

77 views
Skip to first unread message

Tim Dudgeon

unread,
Sep 7, 2014, 12:01:35 PM9/7/14
to fab...@googlegroups.com
I'm trying to create a camel route (similar in principle to the java camel-cdi quickstart example that using a message queue (using the amq endpoint).
I have a working camel camel route (the standard camel-cdi one) and then try to introduce the following dependencies into my pom.xml:

    <dependency>
     
<groupId>io.fabric8.mq</groupId>
     
<artifactId>mq-fabric</artifactId>
     
<version>${fabric8.bom.version}</version>
   
</dependency>
   
   
<dependency>
     
<groupId>io.fabric8.mq</groupId>
     
<artifactId>camel-amq</artifactId>
     
<version>${fabric8.bom.version}</version>
   
</dependency>


But then the route won't start. If I try a
mvn clean camel:run I get output like this:

2014-09-07 16:56:49,006 [weld-worker-2  ] WARN  Validator                      - WELD-001473: javax.enterprise.inject.spi.Bean implementation org.apache.camel.cdi.internal.CamelContextBean@340c3b7f declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.

2014-09-07 16:56:49,009 [cdi.Main.main()] INFO  MainSupport                    - Apache Camel 2.13.2 stopping

[ERROR] *************************************

[ERROR] Error occurred while running main from: org.apache.camel.cdi.Main

[ERROR]  

java.lang.reflect.InvocationTargetException

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

 at java.lang.reflect.Method.invoke(Method.java:606)

 at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:488)

 at java.lang.Thread.run(Thread.java:745)

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Set<Service> with qualifiers @Default

  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)

  at com.google.common.util.concurrent.ServiceManager.<init>(ServiceManager.java:0)


 

 at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)

 at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289)

 at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)

 at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166)

 at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514)

 at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)

 at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)

 at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)

 at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)

 at java.util.concurrent.FutureTask.run(FutureTask.java:262)

 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

 ... 1 more

[ERROR] *************************************


Any ideas what I'm doing wrong?
Any examples of using amq from java routes?

Thanks
Tim

Christian Posta

unread,
Sep 7, 2014, 2:45:50 PM9/7/14
to Tim Dudgeon, fab...@googlegroups.com
I haven't tried it yet, but first thought is that the amq component for camel is really a thin wrapper around the activemq component that is smart enough to automatically pull a connection factory service from and osgi service registry. So in a cdi env I wouldn't think it would work out of the box. Maybe try with plain activemq component?

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Christian Posta
twitter: @christianposta

Tim Dudgeon

unread,
Sep 8, 2014, 3:13:33 PM9/8/14
to fab...@googlegroups.com, tdud...@informaticsmatters.com
So is it "in principle" supposed to work in java child container, or will it always need an osgi container?
I can try using activemq but doing so seems to loose the point that amq component is trying to achieve in fabric8.
Are there any examples of using activemq in a java container?

Thanks
Tim
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christian Posta

unread,
Sep 8, 2014, 3:20:40 PM9/8/14
to Tim Dudgeon, fab...@googlegroups.com
Well, the amq component just grabs a connection factory from OSGI. the fabric8 part (and i assume to autodiscovery is what you're looking for?) is really the discovery transport that activemq can use:

discovery:fabric:<groupname>

so you can use that as your URL for the activemq component, and it will do the same thing the amq component was doing for you. 


To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages