tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reza Rahman <>
Subject MDB Listening on external ActiveMQ broker
Date Sun, 10 May 2009 14:21:38 GMT

I am trying to connect an OpenEJB MDB embedded in a Java SE command-line
application to a JMS topic inside an ActiveMQ embedded broker running
inside Tomcat/OpenEJB. The MDB works fine when it is inside Tomcat, but
that's not that useful in this scenario since I want to perform remote
notification to the Java SE program running outside Tomcat. Here is my
SE bootstrap code:

Properties properties = new Properties();

properties.put("Default JMS Resource Adapter",
properties.put("Default JMS Resource Adapter.BrokerXmlConfig",
"broker:vm://localhost"); // Ideally, I don't want an embedded broker
here at all.
properties.put("Default JMS Resource Adapter.ServerUrl",
"tcp://localhost:61616?async=true"); // Trying to connect to the Tomcat

new InitialContext(properties);

Here is the MDB container configuration on the Tomcat/OpenEJB side:

<Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
  # Broker configuration URI as defined by ActiveMQ
  # see

  BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false // Should
be listening to remote clients

  # Broker address

  ServerUrl vm://localhost?async=true // Should start an embedded broker.

  # DataSource for persistence messages

  DataSource My Unmanaged DataSource

Here is my MDB configuration:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
        @ActivationConfigProperty(propertyName = "destination",
propertyValue = "alertTopic") }) // Can I connect directly to the remote
topic instead?

Can anyone help?

Many thanks in advance,
Expert Group Member, EJB 3.1 and Java EE 6
Author, EJB 3 in Action
Independent Consultant

View raw message