-
1. Re: Switchyard + JMS + Camel
kcbabo Nov 19, 2014 6:35 PM (in response to slayercode2)1 of 1 people found this helpfulYou should be able to achieve this be creating a CDI bean class which extends JmsComponent and uses @Named("jms_activemq"). Or you could have a class with an @Produces @Named("jms_activemq") method which returns a configured instance of JmsComponent.
-
2. Re: Switchyard + JMS + Camel
slayercode2 Nov 20, 2014 7:25 AM (in response to kcbabo)Thank you for your prompt replay. I have created a class "ActiveMQComponentFactory" (as follows) and I have added this route "<to uri="activemqComp://testQueue" />" to my camel script. I had this error: No component found with scheme: activemqComp.
public class ActiveMQComponentFactory extends JmsComponent{
@Produces @Named ("activemqComp")
public JmsComponent createActiveMQComponent() {
JmsComponent ac = new ActiveMQComponent();
try {
InitialContext ic = new InitialContext();
ConnectionFactory cf = (ConnectionFactory) ic.lookup("ConnectionFactory");
ac.setConnectionFactory(cf);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ac;
}
}
I tried to use hornetq instead of activemq by creating the following class and the result was fine and everything was ok.
public class HornetQComponent extends JmsComponent {
@Produces @Named ("hornetqComp")
public JmsComponent createHornetMQComponent() {
JmsComponent hq = new HornetQComponent();
InitialContext ic;
try {
ic = new InitialContext();
ConnectionFactory cf = (ConnectionFactory) ic.lookup("ConnectionFactory");
hq.setConnectionFactory(cf);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return hq;
}
}
I am wondering why hornetq runs well and activemq does not? It seems that JBoss eap 6.1 does ont recognise ActiveMQ.
-
3. Re: Switchyard + JMS + Camel
kcbabo Nov 20, 2014 7:59 AM (in response to slayercode2)ActiveMQ jars are not present in EAP / FSW by default. My guess would be that CDI discovery is reaching your @Produces method, encountering a CNF exception and swallowing it.
-
4. Re: Switchyard + JMS + Camel
slayercode2 Nov 20, 2014 11:48 AM (in response to kcbabo)Thank you for the explanations. The problem is solved.