This recipe provides an example of how to use OSB to publish a message to a remote JMS queue on OC4J via a JMS message bridge. The JMS message bridge will forward messages from a local JMS queue to the remote OC4J queue. An advantage of using a JMS message bridge is that it keeps your OSB configuration clean and simple, and all of the gory details for connecting to the remote JMS location are configured and managed by the WebLogic server. Also, the same bridge could be used by multiple JMS clients should this be required.
You will need to adjust your OSB domain's classpath, as we detailed in the Creating an OSB proxy service to consume JMS messages from OC4J recipe given in this chapter, to bridge between a local JMS queue and a remote OC4J queue.
You will also need the connection details and the JNDI names for a connection factory and a queue on your OC4J server. The connection factory should not be an XA-enabled connection factory.
OC4JBridge
and click on Next.osb_server1
), and click on Next.OC4JLocalCF
and JNDI Name to /jms/OC4JLocalCF
and click on Next, followed by clicking on Finish (you must not just click on Finish, otherwise the connection factory will not get its default target). You will be taken back to the summary of resources where you should see your connection factory.OC4JLocalQueue
and JNDI Name to /jms/OC4JLocalQueue
, and click on Next.
Property |
Value |
---|---|
Name |
|
Adapter JNDI Name |
|
Connection URL |
|
Connection Factory JNDI Name |
|
Destination JNDI Name |
|
Property |
Value |
---|---|
Name |
|
Adapter JNDI Name |
|
Connection URL |
|
Connection Factory JNDI Name |
The JNDI name of a connection factory on your OC4J server |
Destination JNDI Name |
The JNDI name of a queue on your OC4J server |
Property |
Value |
---|---|
Initial Context Factory |
|
User Name |
The username of the account on OC4J that you configured earlier. |
User Password and Confirm User Password |
The password for this account. |
OC4JBridge
as Name and select the Started checkbox. Select Duplicate-Okay as Quality of Service and click on Next.jms://[OSBHOST]:[PORT]/jms.OC4JLocalCF/jms.OC4JLocalQueue
This recipe publishes JMS messages to an OC4J server via a JMS message bridge. Our business service publishes messages to our local JMS queue, which is forwarded by the message bridge to the remote OC4J server. It is important to note (in the setup for this recipe) that the business service returns when the JMS message is accepted by the local JMS server and not when it gets to the OC4J server; this is handled by the bridge asynchronously.
We could have used this method of a JMS bridge in our first recipe instead of the foreign JNDI provider, by having a remote OC4J queue as the source for the bridge and a local queue as the destination; so, the bridge would pull remote messages to our local OSB domain for the proxy service to pick up.
If you need a high message throughput, you will need to tune the message bridge as it defaults to only one thread per bridge. This can be done by either creating multiple bridges for the same JMS bridge destinations or (the preferred option) by creating a work manager for the JMS bridge. More information on this topic can be found in the Performance and Tuning for Oracle WebLogic Server documentation at http://docs.oracle.com/cd/E23943_01/web.1111/e13814/bridgetuning.htm.
This recipe would be simple to extend to other JMS providers by including different libraries on the classpath and adjusting the connection details appropriately.
In the recipe, we selected the quality of service as duplicate-okay, because some versions of OC4J do not offer true XA support and selecting anything other than the quality of service detailed previously will cause the bridge to fail (WebLogic server will try to perform a global transaction and the OC4J server will not have enrolled in it). If you're using an XA-compliant JMS provider (a late version of OC4J, another WLS domain, and so on), you may consider setting a higher quality of service if required.
3.137.211.239