Sunday, June 12, 2016

Bind TIBCO Queue or Topic with WebLogic Server

Bind TIBCO Queue or Topic with WebLogic Server

Get below details from TIBCO EMS system. Example values are shown for understanding only.
      JMS Server Name : tibjmsnaming://host:port
      Queue Name :  JMS.TEST.Q
      Connection Factory :- QueueConnectionFactory                                      
      UserName: userId
      Password : password

Step 1 - Copy tibjms.jar & jms-2.0.jar in WebLogic domain lib folder and add in class path if required. By default WebLogic picks new jar from domain lib folder after restart.

Step 2 - Perform below Config action in WebLogic to bind the Queue or Topic
(a) Create New JMS Module
WebLogic Path:- Services - Messaging - JMS Modules
Name: TIBCOJMSModule.

Note - Keep all other field as default blank and save it.

(b) Create Foreign Server inside newly created JMS module
Name: TIBCOJMSFServer
JNDI Initial Context Factory: com.tibco.tibjms.naming.TibjmsInitialContextFactory
JNDI Connection URL: tibjmsnaming://host:port
JNDI Properties Credential: password
JNDI Properties: java.naming.security.principal=userId

Note - Put tibjms.jar in WebLogic domain lib folder for initial context factory class.

(c) Create Destinations inside newly created Foreign Server
  Name: TIBCOJMSQ
  Local JNDI Name: JMS.TEST.Q.Local
  Remote JNDI Name: JMS.TEST.Q

  Note - You can keep local JNDI same as remote or different. Use the local name in WebLogic ear xml.

(c) Create Connection Factories inside newly created Foreign Server
  Name: TIBCOJMSConnectionFactory
  Local JNDI Name: QueueConnectionFactoryLocal
  Remote JNDI Name: QueueConnectionFactory
  User Name: userId
  Password: password

  Note - You can keep local JNDI same as remote or different. Use the local name in WebLogic ear xml.


Step 3 - Deploy MDB listener EAR in WebLogic

(a) Sample MDB Listener class
public class MyListenerMDB implements MessageDrivenBean, MessageListener
{
 public void onMessage(Message message)
 {
try {
 TextMessage msg;
 if ((message instanceof TextMessage))
 {      
msg = (TextMessage)message;
System.out.println("Message is : " + msg.getText());
 }
} catch (JMSException e){
 e.printStackTrace();
}
 }

 public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) {}
 public void ejbRemove() {}
 public void ejbCreate() {}
}

(b) Sample weblogic-ejb-jar file
<weblogic-ejb-jar>
 <weblogic-enterprise-bean>
<ejb-name>My_TIBCO_TEST_MDB</ejb-name>
<message-driven-descriptor>
 <pool>
<max-beans-in-free-pool>1</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
 </pool>
 <destination-jndi-name>JMS.TEST.Q.Local</destination-jndi-name>
 <connection-factory-jndi-name>QueueConnectionFactoryLocal</connection-factory-jndi-name>
</message-driven-descriptor>
<enable-call-by-reference>True</enable-call-by-reference>
 </weblogic-enterprise-bean>
</weblogic-ejb-jar>

(c) Sample ejb-jar file [If ejb class file is in package folder structure then give full path like com.test.MyListenerMDB]
<ejb-jar>
<enterprise-beans>
<message-driven>
 <ejb-name>My_TIBCO_TEST_MDB</ejb-name>
 <ejb-class>MyListenerMDB</ejb-class>    
 <transaction-type>Container</transaction-type>    
 <message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
 </message-driven-destination>    
</message-driven>
 </enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>MDB_Name</ejb-name>
<method-name>*</method-name>
 </method>
 <trans-attribute>NotSupported</trans-attribute>
</container-transaction>
 </assembly-descriptor>
</ejb-jar>

No comments:

Post a Comment