RSS

Simple Java Client to talk to Queues and Topics in IBM MQ 7.5

02 Apr

IBM MQ is one of Message Queue implementation heavily used for interprocess communication in the software industry.
So I just crated a simple java client to talk to Queues and Topics in the IBM MQ.
Here I’m going to talk to the IBM MQ through the “.binding” file provided by the IBM MQ installation.

1. First you need to install the IBM MQ (I’m using windows machine to Install the IBM MQ).
2. Open IBM WebSphere MQ Explorer and do the following

Create Queue Manager as mymgr
1

Create Local Queue as localq
2

Create Local Topic as localt
3

3. Go to C:\Program Files\IBM\WebSphere MQ\java\bin, and invoke IVT app by running the following command:

IVTRun.bat –nojndi

If successful the following will be displayed:
4

4. Run the following command:
IVTRun.bat -nojndi -client -m mymgr -host localhost -channel mychannel

If successful the following will be displayed:
5

5. Navigate to to C:\IBM\WebSphere MQ\java\bin directory, open ‘JMSAdmin.config’ file and edit the file as follows:
a. Uncomment the configuration for INITIAL_CONTEXT_FACTORY
ex: INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
b. Point to an empty folder for PROVIDER_URL – ex: PROVIDER_URL=file:/C:/JNDI-Directory

6. Create the default set of JNDI bindings by running the following command in the command prompt:
IVTSetup.bat

If successful the following will be displayed:
6

7. Let’s use the JMSAdmin tool to make some modifications in the JNDI bindings
Navigate to the C:\IBM\WebSphere MQ\java\bin directory from the console and start jmsadmin by running the following command:
jmsadmin.bat

Run the following commands:

For Queue:
ALTER QCF(ivtQCF) TRANSPORT(CLIENT)
ALTER QCF(ivtQCF) QMGR(mymgr)
For Topics:

ALTER TCF(ivtTCF) TRANSPORT(CLIENT)
ALTER TCF(ivtTCF) QMGR(mymgr)

8. Go to the “JMS Administered Objects” and select Add initial context. Then select the “File system” and enter the JNDI directory path. Then you can view all created Queues and Topics.

4 (1)

4 (2)

9. Now you can download the Java project here and open it form JIdea and make the following changes and run the client.
Replace your JNDI-Directory path
Replace the Queue Name and Queue connection factory name
Replace the Topic Name and Topic connection factory name

About these ads
 
1 Comment

Posted by on April 2, 2013 in java

 

Tags: , ,

One response to “Simple Java Client to talk to Queues and Topics in IBM MQ 7.5

  1. Jack

    December 22, 2013 at 6:37 pm

    Hi

    I have developed one client for IBM MQ with very light weight component, can you please check:

    http://sourceforge.net/projects/jackibmmqexplorer/

    Regards
    Jack

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: