Testing communication between a client and a server on Solaris
On the IBM MQ MQI client workstation, use the amqsputc sample program to put a message on the queue at the server workstation. Use the amqsgetc sample program to get the message from the queue back to the client.
Before you begin
Complete the previous topics in this section:- Set up a queue manager, channels, and queue.
- Open a command window.
- Set system environment variables.
About this task
Note that IBM MQ object definitions are case-sensitive. Text entered as an MQSC command in lowercase is converted automatically to uppercase unless you enclose it in single quotation marks. Make sure that you type the examples exactly as shown.Procedure
- Change to the MQ_INSTALLATION_PATH/samp/bin directory, which contains the sample programs. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
-
You must set certain environment variables so that the installation can be used in the current
shell. We can set the environment variables by entering the following command:
. MQ_INSTALLATION_PATH/bin/setmqenv -s
where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed. -
Start the PUT program for QUEUE1 on QUEUE.MANAGER.1 by
entering the following command:
./amqsputc QUEUE1 QUEUE.MANAGER.1
If the command is successful, the following messages are displayed:Sample AMQSPUT0 start target queue is QUEUE1
Tip: You might get the error, MQRC_NOT_AUTHORIZED (2035). By default, channel authentication is enabled when a queue manager is created. Channel authentication prevents privileged users accessing a queue manager as an IBM MQ MQI client. For verifying the installation, we can either change the MCA user ID to a non-privileged user, or disable channel authentication. To disable channel authentication run the following MQSC command:ALTER QMGR CHLAUTH(DISABLED)
When you finish the test, if we do not delete the queue manager, re-enable channel authentication:ALTER QMGR CHLAUTH(ENABLED)
-
Type some message text, then press Enter twice.
The following message is displayed:
Sample AMQSPUT0 end
Your message is now on the queue that is on the server queue manager. -
Start the GET program for QUEUE1 on QUEUE.MANAGER.1 by
entering the following command:
./amqsgetc QUEUE1 QUEUE.MANAGER.1
The sample program starts, and your message is displayed. After a short pause (approximately 30 seconds), the sample ends and the command prompt is displayed again.
Results
You have now successfully verified the client installation.What to do next
- You must set various environment variables on the server so that the installation can be used in
the current shell. We can set the environment variables by entering the following
command:
. MQ_INSTALLATION_PATH/bin/setmqenv -s
where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed. - On the server, stop the queue manager by entering the following command:
endmqm QUEUE.MANAGER.1
- On the server, delete the queue manager by entering the following command:
dltmqm QUEUE.MANAGER.1