2. Mule provides a JMS connector, which we could use to connect to WebLogic JMS
destinations.
In this example, we are going to connect to a WebLogic server 12C:
WebLogic Server IP: localhost
WebLogic Server port: 7001
WebLogic Server username: weblogic
WebLogic Server password: welcome1
with JMS queue details below:
JMS Server Name: JMSServer
JMS Module Name: SystemModule-0
JMS Queue Name: Queue-0
JMS Queue JNDI Name: jms/TestQueue
C o n f i g u r i n g M u l e J M S C o n n e c t o r w i t h W e b l o g i c J M S
3. Configure the connector
Mule provides a JMS connector and a WebLogic JMS connector, both can be used here:
<jms:connector name="JMS" username="weblogic" password="welcome1" validateConnections="true"
jndiInitialFactory="weblogic.jndi.WLInitialContextFactory" jndiProviderUrl="t3://localhost:7001"
connectionFactoryJndiName="myfactory" doc:name="JMS"/>
or
<jms:weblogic-connector name="Web_logic_JMS" username="weblogic" password="welcome1"
validateConnections="true" jndiInitialFactory="weblogic.jndi.WLInitialContextFactory"
jndiProviderUrl="t3://localhost:7001" connectionFactoryJndiName="myfactory" doc:name="Web logic
JMS"/>
4. Configure the endpoint
When configuring the JMS endpoint, we need to be careful on the name to use, because there are
2 ways to specify the name:
1) use JNDI name
To use JNDI name, we need to add a Spring property to the connector:
<jms:connector name="JMS" username="weblogic" password="welcome1" validateConnections="true"
jndiInitialFactory="weblogic.jndi.WLInitialContextFactory" jndiProviderUrl="t3://localhost:7001"
connectionFactoryJndiName="myfactory" doc:name="JMS">
<spring:property name="jndiDestinations" value="true"/>
</jms:connector>
or:
<jms:weblogic-connector name="Web_logic_JMS" username="weblogic" password="welcome1"
validateConnections="true" jndiInitialFactory="weblogic.jndi.WLInitialContextFactory"
jndiProviderUrl="t3://localhost:7001" connectionFactoryJndiName="myfactory" doc:name="Web logic
JMS">
<spring:property name="jndiDestinations" value="true"/>
</jms:weblogic-connector>
5. Then we can just use the JNDI name in endpoint:
<jms:inbound-endpoint queue="jms.TestQueue" connector-ref="Web_logic_JMS" doc:name="JMS"/>
Note: using '.' or '/' does NOT make a difference here. The following works too:
<jms:inbound-endpoint queue="jms/TestQueue" connector-ref="Web_logic_JMS" doc:name="JMS"/>
2) use complete WebLogic JMS name
By default, if nothing set, it's using name, and the format is:
JMS_Server_Name/JMS_ModuleName!JMS_Queue_Name, so in this case, it's:
<jms:inbound-endpoint queue="JMSServer/SystemModule-0!Queue-0" connector-
ref="Web_logic_JMS" doc:name="JMS"/>