Tuesday, 6 May 2014

Working_with_JMS_Artifacts


Please refer introduction.

JMS Artifacts

  To work with any JMS Application we need to first create the following artifacts in Weblogic console.(Install and run weblogic server if you are not install yet/ Run Integrated weblogic server which are working with).

  • JMS Server
  • JMS Module
  • JMS Subdeployment
  • JMS ConnectionFactory
  • JMS Queue/JMS Topic(These are the destinations we need to create  Based on our Requirement..see introduction).

Creating JMS Artifacts in Weblogic console
  • Login to Weblogic Console."http://localhost:7001/console".




JMS Server
  •  Click on Services-->Messenging-->JMS Servers.


  • Click on New To Create new JMS Server.
  • Enter any Name for JMS server and click next.


  • NextScreen,Select Target as Admin server and click finish.
  • Observe that JMS server created successfully and your server name in the list of JMS servers

JMS Module


  • From Weblogic console Home page click on JMS Module.

  • Click on New to create New JMS Module.
  • Enter any name for JMS Module and Click next.


  • Select Target as Admin server and Click next.
  • Select the Check box to add our resources to JMS Module and click Finish.
  • It will navigate to JMS Module Configuration Page.Go to Subdeployments tab,To create New Sub deployment to our JMS Resources.And Click on New.
  • Enter any Name for Subdeployment and click next.


  • Select your JMS Server which we have created earlier as targets and click Finish.(dont select admin server)

  • Make sure that your subdeployment created for the JMS Module.



JMS ConnectionFactory

  • JMS Modules-->click on your JMS Module-->Configuration Tab,click on New To create JMS Resources.

  •  First Select Connection Factory Radio button and click next.


  • Enter any Name and JNDI Name for Connection factory as follows.We will use this Jndi name in our Application while working with JMS.Click Next.



  • Click on Advance Targeting to Point our Subdeployment which we have created earlier.




  • Click Finish.

JMS Queue

  • Like Connection factory we need to Create JMS Destination (Here JMS Queue) as follows.



  • In the Resources select Queue and click next..ENter any name For JMS Queue and JNDI name for it..We will use this JNDI name while sending messages to JMS Queue in our Application.

  • Click Next.Select our subdeployment and click Finish.
JMS Topic

  • Create JMS Topic.

  • Enter JMS Topic and JNDI Name.

  • select the Subdeployment and click finish.


  • Done...
Now we are ready to work with JMS Application to send and recieve messages from JMS Queue/Topic when two different applications wants to communicate with each other.

sample Application will update soon..

01_JMS_Introduction to JMS

JMS
  • JMS stands for Java Message Service.
  • JMS is a standard API for accessing enterprise messaging systems. Specifically, JMS:
  •  Enables Java applications sharing a messaging system to exchange messages
  •  Simplifies application development by providing a standard interface for creating, sending, and receiving messages.

Example:

      If we have two Applications Like Application A and Application B.
  • case 1:If the above two applications belongs to two different companies which are trying to communicate.
  • case 2:If the two applications are from Different depatments in the same company
  • case 3:If one application is developed in JAVA  and other is developed in other technology
How the two applications are communicate with each other????


By using JMS Provider those two applications are communicated with each other by sending messages to one another as shown in the following diagram.
  • Messages that are exchanged through JMS PRovider.JMS Provider is also known as Message server,Message Broker,MOM(Message Oriented Middleware).
  • The Application which sends a message to JMS Provier is known as Message Producer where as which recieves the message is known as Message Consumer.
  • Message consumer/producer and what ever is intereact with JMS Provider is known as JMS client.

JMS Provider

  • With in JMS Provider we can create JMS destinations known as Queues and Topics.
  • So the Message Producer can send message to a perticular destination(Queue/Topic) and Consumer can recieve message from a perticular Destination(Queue/Topic).


  • A destination can have more than one producer/consumer.The main advantage of JMS architecture is like loosely coupled means the producer doent know who is going to  recieve the message and the consumer doesnt know who will send the message. 


JMS Messaging Models

 we have two types of JMS Messeging models.

  1. Publish and subscribe Model
  2. Point To Point Model


1.Publish and Subscribe Model

  • In this model Message Producer is known as  Publisher and the Message Consumer is known as Subscriber.
  • The destination we will use in this model is known as Topic.
  • so when the Producer sends the message it will deliver to multiple subscribers as shown in the following figure.

2.Point To Point Model(P2P model)

  • In this model Message Producer is known as sender and  message Consumer is known as Reciever.
  • The destination we will use in this model is Queue.
  • so When the producer sends the message to the queue only a perticular reciever will going to be recieve the message even though we may register number of recievers as shown in the figure.


Please refer JMS example..

Reference:Ashiraj series..