I have activeMQ running on one Jboss server(AS4.2.3) following the steps provided here.http://http://activemq.apache.org/integrating-apache-activemq-with-jboss.html. The things work fine locally.
From another Jboss server an MDB needs to listen to messages on the remote Destination(Topic).Can someone please provide me the steps.
I have figured out following way of doing it. Is it the right approach and if there is a better way please provide the steps..
I tried the normal mbean way of connecting to a remote MDB. But it didn't work .It works fine with JBoss MQ and MDB.
@MessageDriven(name="MessageConsumer", activationConfig = {
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="topic/remoteTopic")
// @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:/RemoteJMSProvider")
})
@ResourceAdapter("active-mq.rar")
public class MessageConsumerBean implements MessageListener {
@Resource
public MessageDrivenContext mdc;
public void onMessage(Message message) {
if(message instanceof ObjectMessage)
{
try {
Object obj = ((ObjectMessage)message).getObject();
// do processing
} catch (JMSException e) {
}
}
}
}
/*
Changing the resourceadapter/config-property of ra.xml of activemq.rar(in deploy folder) on MDB server to point to the remote machine running active mq
<config-property>
<config-property-name>ServerUrl</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>tcp://remActiveMQOnJbossServerAddress:61616</config-property-value>
</config-property>
*/
If you are using the ActiveMQ rar, then you'll have to ask them.
Most likely it is a rar config property or an activation config property you need to change?