[jboss-user] [Messaging, JMS & JBossMQ] - Re: MDB and connection to a remote queue with transaction
mclu
do-not-reply at jboss.com
Tue Jan 2 03:33:20 EST 2007
"genman" wrote : BTW, if you close the connection it closes the session and sender as well.
I know :-)
"genman" wrote :
| Anyway, what does getConnection() do? Are you using the pooled connections at java:/JmsXA ?
It gets the connection and start it from the connectionfactory (of the remote server) and because it is remote it looks for XAConnectionfactory.
The code:
private Connection getConnection() throws JMSException {
|
| Connection connection = null;
| try {
| connection = cf.createConnection();
| connection.start();
|
| } catch (JMSException e) {
| if (connection != null)
| try {
| connection.close();
| } catch (Exception ignore) {
| }
| throw e;
| }
| return connection;
| }
And during ejb create the remote jndi lookup for the connectionfactory is done:
public void ejbCreate() {
| try {
| //remote jndi properties like port and url
| Properties prop = IMConstants.getIMServerProperties();
|
| Context ic = new InitialContext(prop);
|
| cf = (ConnectionFactory) ic.lookup("XAConnectionFactory");
| sendQueue = (Queue) ic.lookup(IMConstants.QUEUE_INCOMINGSYNCREQUESTS);
| ic.close();
| } catch (Exception e) {
| throw new EJBException("Failure to get connection factory or queue: "
| + e.getMessage(),e);
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997183#3997183
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997183
More information about the jboss-user
mailing list