The MQ hypervisor edition provides an easy way to get a virtual machine deployed with a running queue manager in just a few minutes. Once you've deployed a VM you'll typically want to configure MQ further by creating queues and channels and authorising users to access the system. This post describes how you can automate the configuration of these resources by running a custom script package.
Trying it out
The example script package configures a newly deployed queue manager so that a MQ client application can connect to it. iI shows how you can automate the creation of queues and users and add a server connection (SVRCONN) channel called USER.SVRCONN. It grants authority to the new users so that they can connect to the queue manager and so that they can browse, put, get, and inquire the new queues. The queues can be optionally added into an MQ Cluster.
Uploading the Script Package
Follow these steps to upload the script package:
- Download the script package
- Log into you IWD / PureApp / SCO web console and navigate to Catalogue > Script Packages
- Click the New icon on the toolbar to add a new script package (see reference links to the infocentre for more information) and name the script package MQDEMO: Add Channel Users and Queues
- In the Script package file section, click Browse, and select the MQDEMOAddUserChannelAndQueues.zip file you downloaded in 1, then click upload
- This script package includes a file called cbscript.json which contains all the information required to configure the scrip package, including the parameters that must be passed to the script package, and when the script package executes (at virtual system creation). Your script package should look like the screen below.
Using the Script Package in a Pattern
To use the script package follow these steps to create a virtual system pattern:
- Navigate to Patterns > Virtual Systems
- Click the New icon on the toolbar to add a new virtual system pattern and name it MQ Script Package Demo
- Click the Edit button on the toolbar
- Add an MQ Basic part to the pattern by dragging and dropping from the palette of parts on the left.
- Click the Scripts section on the palette to expand the list of scripts and drag and drop the script you created in the previous section onto the part. Your pattern should look like the screenshot below.
- If you want to you can edit and/or lock the default values for the part of the script package by clicking the properties icon.
- Once you're finished, click Done editing and you are ready to deploy.
Deploying the Script
- From the Virtual System Pattern you created in the previous section, click Deploy
- Enter a name for the virtual system instance and click on Configure virtual parts
Enter values for passwords and the queue manager name, then scroll down to the bottom of the list of parameters and you will see the values that are specific to the script package as shown below
Enter a list of user names, queue names, or cluster names separated by a space.
- The users and queues will be created on the queue manager and the queues will be added into the cluster you specify. For this example script enter the user name that you use to log on to your computer. This is the value that the MQ client sample will pass through to MQ for authorisation.
- The special value 'null' can be entered for any of the parameters to indicate that no action should be taken.
- Click OK when you have finished, and OK again to deploy the pattern.
Testing the Script Package
- Once the pattern has deployed, navigate to Instances > Virtual Systems, select the instance you just deployed, and expand the Virtual machines twistie to find the IP address of the machine you just deployed.
On the client machine set up the MQSERVER environment variable to define the client connection to the deployed instance. e.g.
Run the MQ client PUT sample - amqsputc - and put some messages to the queue you defined (press enter twice on amqsputc to end the program). e.g.
Run the MQ client GET sample - amqsgetc - and get the messages back off the queue. e.g.
You should see that you can connect your client to the queue manager and put and get the messages as shown in the screenshot.