In Chapter 6, the use of the outbound JMS Adapter in SOA Suite is described. In order to implement the services described in the chapter, some setting up of JMS resources is required in your WebLogic Server. This article describes the steps you need to go through in terms of preparation, resulting in a JMS queue with a JNDI name of jms/finance/AircraftMovementsQueue in the SOAJMSModule and a Connection Factory called jms/finance/FinanceConnectionFactory in that same JMS Module.
Note: in real life you should be creating your own JMS Module instead of using the SOAJMSModule that SOA Suite uses itself. In the context of the book, to keep things simple, we will violate that rule.
Before we can start using the JMS Adapter as well as external queue clients for sending and consuming JMS messages, we need to configure the JMS Queue(s). JMS It is not part of the SOA Suite, but is provided by the Oracle Enterprise Messaging Service (OEMS) in WebLogic Server 12c. Administration of JMS is done through the WebLogic Server Console that is accessed through a browser – typically at http://host:7001/console.
Configure JMS Queue
First we create the JMS Queue we will use for specific message based interaction. Open the WebLogic Server Console. In the navigation tree Domain Structure on the left side of the page, select node JMS Modules under Services, Messages. Click on SOAJMSModule in the list of JMS Modules.
Cick on the New button in Resource Summary that appears.
Select the radio button Queue for the type of the JMS resource to create. and press Next.
Set the Name for the new JMS Queue to finance_AircraftMovementsQueue and its JNDI name to jms/finance/AircraftMovementsQueue; accept None for the template; press Next.
Select the SOASubDeployment on the next page and the SOAJMSServer from the list of JMS Servers. Click on Finish
The console displays comforting messages about the successful creation.
Configure JMS Connection Factory
We also need to configure a JMS ConnectionFactory to power the JMS Adapter instance that we will be using – as well as other JMS clients. This connection factory is used by the JMS adapter and other clients to retrieve JMS connections, for example to the queue we have just configured.
Return to the Summary of Resources table for the SOAJMSModule. Click on New to create a new resource, this time of type Connection Factory.
Enter a name of finance_FinanceConnectionFactory and a JNDI name of jms/finance/FinanceConnectionFactory. Click on Finish to create the new resource.
The overview page for the JMS Module SOAJMSModule now lists the two new resources – the Queue and the Connection Factory.
With these resources set up, you can proceed with the JMS Adapter configuration.
In case of multiple managed servers
When you use separate managed servers for Service Bus and SCA engine, the JMS Adapter invoked from Service Bus will run on the managed server for OSB where it will not find the JMS Module SOAJMSModule and therefore will also not be able to locate the jms/finance/AircraftMovementsQueue. In this case, you need to define your own JMS Module, add the AircraftMovementsQueue to it and target this JMS Module to the managed server running Service Bus.
A JMS server acts as a management container for resources within JMS modules. Some of its responsibilities include the maintenance of persistence and state of messages and subscribers. A JMS server is required in order to create a JMS module.A JMS module is a definition which contains JMS resources such as queues and topics. A JMS module is required in order to create a JMS queue.JMS modules are targeted to one or more WLS instances or a cluster. Resources within a JMS module, such as queues and topics are also targeted to a JMS server or WLS server instances.
A subdeployment is a grouping of targets. It is also known as advanced targeting. A subdeployment is not necessary for the JMS queue to work, but it allows you to easily target subcomponents of the JMS module to a single target or group of targets. We will use the subdeployment in this example to target the following connection factory and JMS queue to the JMS server we will create..
The steps are now:
- create JMS Server
- create JMS Module
- create JMS Subdeployment
- create queue and connection factory
Click Services | Messaging | JMS Servers. In the right side of the page, click on New
Configure the new JMS Server Set the name to SaibotJMSServer. Ignore the persistent store setting for now (the JMS resources will be in memory only). Press Next
Select one of the managed servers in your domain as the target. The JMS resources in the JMS Module will be linked to the JMS Server through a Subdeployment; each JMS resource can be linked to a single subdeployment which means to a single JMS Server. In short: this server is the target on which the JMS resources in the JMS Module will be available.
Press finish. The JMS Server is created:
Next, create the JMS Module, targeted to this JMS Server:
Press New. The wizard appaears:
Set the name to SaibotJMSModule.. Press Next.
Select the managed server to which this module should be targeted:
Press Next.
Press Finish.
Next, we will create a JMS subdeployment.
Set the name to SaibotJMSSubDeployment:
Press Next.
Here you can select the target(s) for the subdeployment. You can choose either Servers (i.e. WebLogic managed servers, such as the soa_server1) or JMS Servers such as the JMS Server created earlier. As the purpose of our subdeployment in this example is to target a specific JMS server, we will choose the JMS Server option.
Press Finish.
After creating the JMS Server and the JMS Module and the Subdeployment, we can now create the Connection Factory and Queue as described above – this time as resources in the SaibotJMSModule rather than the SOAJMSModule and targeted to the SaibotJMSSubDeployment.
The final situation should be:
Resources
Blog article JMS Step 1 – How to Create a Simple JMS Queue in Weblogic Server 11g by John Brown Evans – https://blogs.oracle.com/soaproactive/entry/how_to_create_a_simple