Basic MQ commands

Source: Internet
Author: User

Physical Definition
######################################## ##########

-- View MQ version --
Dspmqver

-- View queue status --
Dspmq

-- Create a queue manager --
Crtmqm-Q ecis_qm

-- Delete queue manager --
Dltmqm ecis_qm

-- Start the queue manager --
Strmqm ecis_qm

-- Disable the queue manager --
Endmqm-I ecis_qm stop now
Endmqm-P ecis_qm force stop

-- Run the queue manager --
Runmqsc ecis_qm

-- Define listener --
Define listener (lsr_4_ecis_qm) trptype (TCP) Port (1616) control (qmgr) replace
Start listener (lsr_4_ecis_qm)

-- Define a channel --
Define channel (ECIS. svrconn) chltype (svrconn) mcauser ('mqm') replace

-- Start Channel --
Runmqchlorophyll-C chlname-M ecis_qm

-- Start listening --
Runmqlsr-t tcp-P 1616-M ecis_qm
Endmqlsr-M ecis_qm

-- Define queue --
Define QL (q_svc2adp_4_telnet) replace
Define QL (q_svc2adp_4_jdbc) replace
Define QL (q_svc2adp_4_http) replace
Define QL (q_svc2adp_4_socket) replace

-- Delete a queue --
Delete QL (q_svc2adp_4_telnet)

-- View listener --
Display listener (lsr_4_ecis_qm)

-- View Channel --
Dis CHS (*)

-- View Channel --
Display QL (*) [all]

-- View queue depth --
Display QL (q_svc2adp_4_http) curdepth

-- Clear queue message --
Clear QL (q_svc2adp_4_http)

-- View ccsid --
Display qmgr all

-- Modify ccsid --
Alter qmgr [force] ccsid (5488)

Logical definition
######################################## ##########
./Jmsadmin

Delete qcf (t_ecis_qcf)

Delete Q (t_ecis_q_svc2adp_telnet)
Delete Q (t_ecis_q_adp2svc_telnet)
Delete Q (t_ecis_q_svc2adp_jdbc)
Delete Q (t_ecis_q_adp2svc_jdbc)

Delete Q (t_ecis_q_svc2adp_http)
Delete Q (t_ecis_q_adp2svc_http)
Delete Q (t_ecis_q_svc2adp_socket)
Delete Q (t_ecis_q_adp2svc_socket)

Define qcf (t_ecis_qcf) DESC () Tran (client) host (10.151.128.13) qmgr (t_ecis_qm) Chan (t_ecis.svrconn) Port (2626) ccsid (5488)

Define Q (t_ecis_q_svc2adp_telnet) DESC () qmgr (t_ecis_qm) Queue (q_svc2adp_4_telnet) ccsid (5488)
Define Q (t_ecis_q_adp2svc_telnet) DESC () qmgr (t_ecis_qm) Queue (q_adp2svc_4_telnet) ccsid (5488)
Define Q (t_ecis_q_svc2adp_jdbc) DESC () qmgr (t_ecis_qm) Queue (q_svc2adp_4_jdbc) ccsid (5488)
Define Q (t_ecis_q_adp2svc_jdbc) DESC () qmgr (t_ecis_qm) Queue (q_adp2svc_4_jdbc) ccsid (5488)

Define Q (t_ecis_q_svc2adp_http) DESC () qmgr (t_ecis_qm) Queue (q_svc2adp_4_http) ccsid (5488)
Define Q (t_ecis_q_adp2svc_http) DESC () qmgr (t_ecis_qm) Queue (q_adp2svc_4_http) ccsid (5488)
Define Q (t_ecis_q_svc2adp_socket) DESC () qmgr (t_ecis_qm) Queue (q_svc2adp_4_socket) ccsid (5488)
Define Q (t_ecis_q_adp2svc_socket) DESC () qmgr (t_ecis_qm) Queue (q_adp2svc_4_socket) ccsid (5488)

Common WebSphere MQ commands and configurations
######################################## ##########
// Create a local queue Q
Define qlocal (q)
// Set the maximum depth of Q in the local queue to 5
Alter qlocal (q) maxdepth (5)
// Re-create the local queue Q. If Q already exists, reset all its attributes to the default attributes.
Define qlocal (q) replace
// Create a Remote Queue
Define qremote (qrname) rname (AAA) rqmname (qmgrname) xmitq (qtname)
// Create a transmission queue
Define qlocal (clv_hq_tran) usage (xmitq) initq (system. Channel. initq) trigdata (rev_clv) trigtype (every) trigger replace
// Create the receiver channel C
Define channel (c) chltype (rcvr)
// Create the sender channel C. the IP address of the connection peer is 10.10.10.10, and the transmission queue of the 1414 channel connection is XQ.
Define channel (c) chltype (SDR) conname ('10. 10.10.10 (1414) ') xmitq (XQ)
// Create a requester Channel
Define channel (d) chltype (rqstr) conname ('10. 10.10.10 (1414 )')
// Create a server Channel
Define channel (d) chltype (SVR) xmitq (xq1)
// Create a server connection Channel
Define channel (e) chltype (svrconn) replace

// Display all remote queues
Display qremote (*)
// Display all channels
Display channel (*)

// Define the dead Message Queue
Define qlocal (Queue) defpsist (yes) replace

// Set the dead message queue of the queue manager
Alter qmgr deadq (Queue)

Set maxchannels and maxactivechannels attributes (maximum number of connections)
######################################## ##########
Maxchannels and maxactivechannels represent the maximum number of channels allowed to be configured by the queue manager and the number of channels allowed to run simultaneously. The default value of maxchannels is 100, and the default value of maxactivechannels is the same as that of maxchannels. If the number of concurrent channel connections exceeds 100, you need to modify these two parameters. This is especially important for communication between highly concurrent clients and servers.
On the UNIX platform, modify the Qm. ini file and add the following (Path:/var/MQM/qmgrs/hq_svr ):
Channels:
Maxchannels = 3000 (maximum number of channels)
Maxactivechannels = 3000 (maximum number of active channels)
Pipelinelength = 2
Adoptnewmca = all
Restart MQ

// Define the persistent queue:
Define qlocal (QNAME) defpsist (yes) replace

Transmission Queue Management
######################################## ##########
1: Define a transmission queue
Define qlocal (q_transfer) usage (xmitq)
Note:
Q_transfer: name of the transmission queue

The following defines an input queue with a trigger
Define qlocal (q_transfer) usage (xmitq) defpsist (yes) initq (system. Channel. initq) trigdata (dp_rchannel) replace
Note:
Parameter 1: Transfer queue name (q_transfer)
Parameter 5: trigger data (dp_rchannel), that is, the channel to be started after the trigger.

2: Define a trigger on the transfer queue Column
Dpcis_q_transfer: Transmission queue
Trigger data: dp_rchannel, that is, the sending channel, which is started when triggered
Alter qlocal (dpcis_q_transfer) trigdata ('dp _ rchannel') trigtype (every) trigger initq ('System. Channel. initq ')

Remote Queue Management
######################################## ##########
Run the following command to define the Remote Queue:
Define qremote (Q1) rname (Q1) rqmname (qm_apple) xmitq (qm_apple)
Note:
Parameter 1: queue name (sender's Remote Queue name)
Parameter 2: Remote Queue (recipient's local receiving queue name)
Parameter 3: Remote Queue Manager (name of the receiver Queue Manager)
Parameter 4: Transmission Queue (sender's transmission queue name)

Channel Management
######################################## ##########
1: Create a receiver Channel
Define channel (SDR _ test) chltype (rcvr) replace
Define channel (q_r_channel2) chltype (rcvr) replace
Note:
Parameter 1: receiver channel name
Replace: indicates that this channel has been replaced.

2: Create a sender Channel
Define channel (sdrname) chltype (SDR) conname ('2017. 100.100.215 (100) ') xmitq (qtname) replace
The chltype can be SDRs, SVR, rcvr, rqstr, clntconn, svrconn, clussdr, and clusrcvr.

Define channel (dp_rchannel) chltype (SDR) conname ('10. 101.2.3 (1414) ') xmitq (q_transfer) replace
Note:
Channel name: dp_rchannel (sender channel name)
Transmission queue: q_transfer (name of the sender transmission Queue)

3: Start the channel
Start Channel (qm_orange.qm_apple)

4: view the channel status
Dis CHS (*)

Listener Management
######################################## ##########
1: Define the listener
Define listener (tcpls1) trptype (TCP) Port (1414) replace

2: Start the listener
Start listener (tcpls1)
3: Display listener Information
Display listener (tcpls1)

Create trigger
######################################## ##########
MQ triggers are generally set for two purposes: one is to automatically start the sender channel, and the other is to monitor queue messages. Once a new message is found, the corresponding processing process is started using the trigger.
If the trigger is used to automatically start the sender channel, use method 1. If the trigger is used to start the user process, use method 2.

Method 1
A sets the trigger on the transmission channel and opens the trigger control. The type is "first"
The initial queue of B is system. Channel. initq. This queue is a dedicated MQ channel to start the queue and does not need to be manually started to trigger the monitor.
C trigger data is the sender channel name, for example, qag.50
D. Test the message placement in the transmission channel when the sending channel is not active.

Method 2
A creates a trigger queue with the template system. Default. Initiation. queue.
Runmqsc
Define qlocal (MQ. triger. iniqueue) Like (system. Default. Initiation. Queue)
B defines the process. The so-called process is the program to be triggered by the trigger. In this example, the process name: triger. Program Application ID is: "notepad.exe"
C. Set the trigger on the queue, which is generally a local queue. Open the trigger control and select "first" and "each" or "depending on the number of messages" for the type according to your needs"
D. Select the trigger start queue created in a for the initial queue. For example, MQ. triger. iniqueue. Set the process name to the process name defined in B, for example, triger. program.
E. Start the trigger monitor runmqtrm-M qagwy-q mq. triger. iniqueue
F. Put messages in the local queue for testing.

Method 2 can also work on method 1. You only need to change the Application ID in the process definition to runmqchlorophyll-M qagwy-C qag.50, however, MQ provides a dedicated channel to start the queue,
The trigger monitor does not need to be manually started for this queue. Therefore, method 1 requires less steps than method 2 and is easy to configure. Therefore, when the trigger is used to automatically start the sending channel, or method 1 is better.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.