My goal is to subscribe to dynamic topics (= topics created dynamically in runtime) close to a remote message broker provided by ActiveMq-Artemis.
As mentioned in https://developer.jboss.org/wiki/HowToUseOutOfProcessActiveMQWithWildFly <https://developer.jboss.org/wiki/HowToUseOutOfProcessActiveMQWithWildFly> , I tried to use ActiveMQ Resource Adaptater either by including activemq-rar.rar in WildFly deployments directory or by creating a JBoss module containing the RA code but neither solution works. If someone has an idea I will be very grateful :-) *Let us take the first solution activemq-rar.rar in WildFly deployments directory* (in fact the RA is inserted in my ear called cse.ear) ISSUE : when Wildfly starts, I do not see the log "Registered connection factory java:/ConnectionFactory". And in runtime I have an exception : /Unable to instantiate endpoint: java.lang.IllegalArgumentException: WFLYWELD0049: Error injecting resource into CDI managed bean. Can't find a resource named java:/ConnectionFactory defined on javax.jms.ConnectionFactory / You can see below the complete exception, my Wildfly configuration and the code for the topic subscrition: import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.annotation.Resource; import javax.inject.Inject; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSConsumer; import javax.jms.JMSContext; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.Session; import javax.jms.Topic; import org.jboss.ejb3.annotation.ResourceAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @ResourceAdapter("activemq-rar") public class DurableSubscribeToBroker { private ConsumerMessageListener consumerListener; public DurableSubscribeToBroker(){ } @Resource(lookup = "java:/ConnectionFactory") ConnectionFactory cf; @Inject public void setConsumerMessageListener(ConsumerMessageListener consumerListener) { this.consumerListener = consumerListener; } public void subscribe(String durableSubscriptionName) throws JMSException { Connection connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("myDynamicTopic"); session.createDurableSubscriber(topic, durableSubscriptionName); MessageConsumer consumer = session.createConsumer(topic); consumer.setMessageListener(consumerListener); } -- View this message in context: http://activemq.2283324.n4.nabble.com/How-to-use-dynamic-topics-with-ActiveMQ-Artemis-and-Wildfly-tp4723892.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
