We use JMS queues for reliable messaging or for asynchronous communication with other legacy systems or third party systems. The JMS queues can reside in local WLS or in remote server. Here, in this post we discuss about using JMS transport in OSB and demonstrates the same using queues in local WLS. You can refer to this link for more explanation on different JMS Resources. And the OSB project used for demonstration can be downloaded from this link.
JMS queues are always referred in context of a Connection Factory, so you need to create Connection Factory first and then actual JMS queues.
In OSB, JMS transport is used to either enqueue or read messages(poll) from JMS queues. To enqueue the messages, use JMS transport in business service and to poll/read messages from JMS queue, use JMS transport in proxy service.
Setup:
- Open WLS Admin console and navigate to Home -> Messaging -> JMS Modules. Click ‘New’ to create new JMS module.
- Enter name for this new JMS module and click ‘Next’.
- Select all target servers and click Next.
- Click Finish and verify new JMS module has been created successfully.
- Now you can proceed to create Connection Factory and JMS Queue. Navigate to DemoJMSModule–> New and select Connection Factory.
- Click Next and give name for both Connection Factory and JNDI.
- Click Next. The target server will be selected automatically for connection factory. Click Finish.
- Click New and select type of resource as Queue.
- Click Next and give name for Queue and JNDI.
- Click Next and proceed to create new Sub Deployment.
- Provide name for this new sub deployment and click OK.
- Select an existing target JMS server and click Finish.
- Verify that JMS queue is created in DemoJMSModule.
Using JMS Transport at Business Service:
- Create a XML based business service.
- Go to Transport tab and select protocol as JMS. Observe that endpoint URI pattern:
jms://<hostname>:<port>/<JNDI of connection factory>/<JNDI of queue>
- If JNDI name has ‘/’, then it should be replaced with ‘.’, while specifying endpoint URI in business service.
- Navigate to JMS Transport tab. Select Queue as destination type, Text as message type and None as response queue.
- Now you are done with business service. So deploy OSB project and test by giving any sample XML or text message in test console. To view messages in queue, navigate to Home->Messaging->JMS Modules-> DemoJMSModule->DemoQueue-> Monitoring. Select the queue and click on Show Messages to see all messages.
- Click on specific message to verify.
Hi,
I tried the JMS transport in my sample Project
The invocation resulted in an error: oracle.tip.adapter.jms.JmsConnectionFactory cannot be cast to javax.jms.Destination.
getting an above error..
Do u know the reason for this?
I did the same steps but i am getting following error:
Error Message
The invocation resulted in an error: [JMSPool:169803]JNDI lookup of the JMS connection factory jms.demo.DemoConnectionFactory failed: javax.naming.CommunicationException: t3://localhost:7001: [RJVM:000575]Destination 0:0:0:0:0:0:0:1, 7001 unreachable.; nested exception is:
java.net.ConnectException: Connection refused; [RJVM:000576]No available router to destination.; nested exception is:
java.rmi.ConnectException: [RJVM:000576]No available router to destination. [Root exception is java.net.ConnectException: t3://localhost:7001: [RJVM:000575]Destination 0:0:0:0:0:0:0:1, 7001 unreachable.; nested exception is:
java.net.ConnectException: Connection refused; [RJVM:000576]No available router to destination.; nested exception is:
java.rmi.ConnectException: [RJVM:000576]No available router to destination.].
are you able to access admin console using 7001 port. Also check the targets for your connection factory in admin console
good one … thanks for posting
I also I think that the images are very very small
Will try to improve this in some time.
Images are too small to read.
Reposted the blog post with more clearer images