MDB on One AS7 getting messages from another AS7 with HornetQ JMS Server
billhmoore Sep 3, 2013 3:33 PMI have creates a MDB:
package gov.utah.dts.messageDrivenBean;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
/**
* Message-Driven Bean implementation class for: AccountTransferOutboundMDB
*/
@MessageDriven(name = "AccountTransferOutboundMDB",
activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/topic/whm_dev_ATROutboundTopic"),
@ActivationConfigProperty( propertyName="subscriptionDurability", propertyValue="Durable"),
@ActivationConfigProperty( propertyName="messageSelector", propertyValue ="type='String'"),
@ActivationConfigProperty( propertyName="clientID", propertyValue="MYCATR"),
@ActivationConfigProperty( propertyName="subscriptionName", propertyValue="ATROutbound")
})
public class AccountTransferOutboundMDB implements MessageListener {
| /** | |
| * Default constructor. | |
| */ | |
| public AccountTransferOutboundMDB() { |
| } |
/**
| * @see MessageListener#onMessage(Message) | |
| */ | |
| public void onMessage(Message message) { |
| try | |||
| { | |||
| String msgText = ((TextMessage) message).getText(); | |||
| System.out.println("Incoming message: " + msgText); | |||
| //if ("stop".equals(msgText)) { | |||
| //stop = true; | |||
| //} else { | |||
| String documentId = msgText.substring(23); | |||
| System.out.println("Document ID: " + documentId); | |||
| //processDocument(documentId); | |||
| //} | |||
| } | |||
| catch (Throwable e) | |||
| { | |||
| e.printStackTrace(); | |||
| //stop = true; | |||
| } |
}
}
One question is how do I get this MDB to use a specific connection pool?
I have the following in my standalone-full.xml:
| <pooled-connection-factory name="ConnectionFactory1Mgmt"> | |||||
| <user>billhmoore4</user> | |||||
| <password>pebhup2012</password> | |||||
| <client-id>MYCATR</client-id> | |||||
| <connectors> | |||||
| <connector-ref connector-name="remote-jms-mgmt"/> | |||||
| </connectors> | |||||
| <entries> | |||||
| <entry name="java:/ConnectionFactory1Mgmt"/> | |||||
| </entries> | |||||
| </pooled-connection-factory> |
This is the connection pool the MDB needs to use?