Search code examples
jmswebsphereibm-mq

why need queue in WAS Server and websphere MQ?


I am working in a new project.The project consists of using websphere MQ, Websphere server. We have queue in the Websphere MQ including Queue manager.We also have the queue and connection factory defined in the websphere application server. Now, my question here is why we need o create queue and connection factory in the websphere application server, even they are defined in the WEBSPHERE MQ.Can't our application directly use the queue defined in the Websphere MQ?

Please clear my query.Thank you in advance.


Solution

  • Actually, the Connection factory is not defined in WebSphere MQ. The queue is but it's not the same as what you are creating in WAS.

    When using JMS the objects have two interfaces. The JMS API is the interface seen by the code and developers. The Service Provider Interface is the part that interacts with a particular JMS transport provider. It takes both of these to make a JMS object such as a QCF or Destination.

    When you create an object definition in WAS (or any JNDI repository, for that matter) what is created is an object that the program can refer to (the JMS API part) but that also "knows" how to talk to the specific transport provider as well (the SPI part). So when you define a queue in WAS it is a directory entry that points to an actual physical queue defined in the transport provider, in this case WebSphere MQ. Similarly, when you define a Connection Factory, it is also nothing more than a directory entry that conforms to the JMS API and also "knows" how to talk to the transport provider using its proprietary protocol and wire formats. In this case since the transport provider is WebSphere MQ, that Connection Factory directory entry has to know about things like QMgr name, host, port, channel, SSL/TLS details, etc.

    In some cases where the app server is the transport provider (i.e. WAS with Service Integration Bus as the JMS transport) creating the JMS object definition creates the physical object at the same time.

    The reverse is also true. In WebSphere MQ when you crate a queue or topic using WebSphere MQ Explorer, you have the opportunity to define the JMS object definition, provided that you have configured WMQ Explorer to talk to the repository where the managed objects are stored. For example, you can use LDAP to store managed object definitions, point both WebSphere MQ Explorer and WAS at the LDAP directory and manage all the JMS objects there.

    So to reiterate, defining the JMS object in WAS creates only the directory entry and not the actual WMQ object. This is true for any external JMS transport that you use with WAS.