View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jms.websphere;
8   
9   import org.mule.api.construct.FlowConstruct;
10  import org.mule.api.endpoint.InboundEndpoint;
11  import org.mule.api.lifecycle.CreateException;
12  import org.mule.api.lifecycle.InitialisationException;
13  import org.mule.api.transport.Connector;
14  import org.mule.transport.jms.XaTransactedJmsMessageReceiver;
15  
16  import javax.jms.Session;
17  
18  public class WebsphereTransactedJmsMessageReceiver extends XaTransactedJmsMessageReceiver
19  {
20      public WebsphereTransactedJmsMessageReceiver(Connector connector, FlowConstruct flowConstruct, 
21          InboundEndpoint endpoint) throws InitialisationException, CreateException
22      {
23          super(connector, flowConstruct, endpoint);
24      }
25      
26      protected void doConnect() throws Exception
27      {
28          if (connector.isConnected() && connector.isEagerConsumer())
29          {
30              createConsumer();
31          }
32  
33          // TODO make it configurable. This connection blip is killing performance with WMQ, session create() and close()
34          // are the heaviest operations there, synchronizing on a global QM for this machine
35          // MULE-1150 check whether mule is really connected    
36          if (connector.isConnected() && !this.connected.get() && connector.getSessionFromTransaction() == null)
37          {
38              // check connection by creating session
39              Session s = connector.getConnection().createSession(false, 1);
40              s.close();
41          }
42      }
43  }
44  
45