SaN SaN - 11 days ago 5
Java Question

Access Remote IBM MQ Server Queue using MQ Client through a java program

I am relatively new to IBM MQ.

My requirement is to connect to a Remote IBM MQ Server Queue through IBM MQ Client. And then, access the queue through MQ Client using IBM MQ Java API.

Is this the right approach?

I have already setup IBM MQ Server, IBM MQ Explorer on my local machine, created a Queue Manager, Queue. I have also written a Java program to connect to MQ using IBM MQ API.

This Java program has the following parameters:

String queueManagerName = "QUEUE.MANAGER.1";
String userID = "";
String password = "";
String queueName = "QUEUE1";
String hostName = "localhost";
String channel = "CHANNEL1";
int port = 1414;

Here, everything seems to work fine. I can send/receive messages from/to the MQ Server Queue through the Java program.

Now, I have installed IBM MQ Client on the same machine, how do I connect to the same Server Queue using the java program through the MQ Client?

My requirement is to have:

  1. MQ Server running on a different machine.

  2. Connect to the Server Queue using the MQ Client installed on local machine.

  3. The java program should Send/Receive messages to the Server Queue through the local MQ Client.

How, can I achieve this?


You will need to point connection parameters for your application to connect to queue manager on remote machine. For example:

String queueManagerName = "<Remote queue manager name>";
String userID = "<valid user existing on remote machine>";
String password = "<password for user>";
String hostName = "<remote host name>";
String channel = "<Channel name on remote queue manager>";
int port = <port number where queue manager is listening>;

But you will need to configure authentication and authorization on remote queue manager for application to connect. If that is not configured, then you will get MQRC 2035 - NOT_AUTHORIZED errors.