MQ interconnection in JMS

Source: Internet
Author: User

1: Create a queue manager:
Log on to the WebSphere MQ server as an administrator and run the WebSphere MQ control command dspmq to display the status of the existing Queue Manager:
Dspmq
For example, the queue manager used by the project is mqcosmos. If not, create one:

Crtmqm-Q mqcosmos
If the mqcosmos status is "ended unexpected", you need to start it:
Strmqm mqcosmos
Stop message Manager:
Endmqm mqcosmos
Enable the mqsc command:
Runmqsc mqcosmos

Mqsc command:
Show all queues under the queue manager:
Display qstatus (*)
View the number of messages in the queue:
Dis QL ('icareql. onl. Prod. request') curdepth
Create a local message queue:
Define qlocal (icareql. onl. Dev. Dispatch)

View the Channel Definition:
Display channel (*) trptype, convert

View the channel status:
Display chstatus (*) Current

Ping channel (only available in the sending channel and server channel)
Ping channel (system. Def. Sender ).

Clear the message in the queue:
Clear qlocal ('myqueue ');
It is worth noting that when this message queue is being used by a third party, the clear command will not succeed on its own (for example, when an MDB of was is using this message queue)

We recommend that you define a dead-letter queue:
Check whether the message queue is defined in MQM:
Display qmgr deadq
Return Value:
Qmname (mqm_was55_ntel) deadq ()
Then: Define a queue:
Define qlocal ('mydeadq') defpsist (yes) maxdepth (20000) maxmsgl (4194304) replace
Set this queue as a dead-letter queue:
Alter qmgr deadq ('mydeadq') trigint (10000)
View again:
Display qmgr deadq
Return Value:
Qmname (mqm_was55_ntel) deadq (mydeadq)

End mqsc:
End

Mqsc scripts required for two-way communication between two queue managers.

To achieve interconnection between two MQM instances, the following infrastructure is required:
On the source queue manager:
Sending Channel
Remote Queue Definition
Transmission queue
Dead Message Queue

On the target Queue Manager:
Receiving Channel
Target queue
Dead Message Queue

Because mutual communication is required and two-way communication is required, each MQM is both a source queue and a target queue.

In the local queue manager (qma) (eg: local IP: 192.168.10.222, remote IP: 192.168.10.154 ):

* Echo "change the dead message queue to deadq"
Alter qmgr deadq ('destadq') trigint (10000)

* Echo "define Remote Queue"
Define qremote ('qrb') defpsist (yes) xmitq ('qmb') rname ('qlb') rqmname ('qmb') replace

* Echo "defines the dead message queue"
Define qlocal ('deadq') defpsist (yes) maxdepth (20000) maxmsgl (4194304) replace

* Echo "defining local receiving queues"
Define qlocal ('qla') defpsist (yes) maxdepth (100000) maxmsgl (1048576) trigger trigtype (first) process ('cics. pro') initq ('System. CICs. initiation. queue ') replace

* Echo "define transmission queue"
Define qlocal ('qmb') defpsist (yes) maxdepth (100000) maxmsgl (1048576) usage (xmitq) trigger trigtype (first) trigdata ('a. B ') initq ('System. channel. initq ') replace

* Echo "modifying system. CICs. Initiation. Queue queue attributes"
Alter qlocal ('System. CICs. Initiation. Queue ') descr ('websphere MQ default CICs initiation queue') defpsist (yes) maxdepth (100000) maxmsgl (1000)

* Echo "defines the receiving channel"
Define channel ('B. A') chltype (rcvr) trptype (TCP) batchsz (50) hbint (300) mrrty (10) mrtmr (1000) replace

* Echo "defines the sending channel"
Define channel ('a. B ') chltype (SDR) trptype (TCP) batchsz (50) conname ('2017. 168.10.154 ') discint (1800) hbint (300) longrty (999999999) longtmr (300) shortrty (10000) shorttmr (30) xmitq ('qmb') replace
Define channel ('System. admin. svrconn') chltype (svrconn) trptype (TCP) hbint (300) maxmsgl (4194304) mcauser ('mqm') replace

* Echo "define the receiving process"
Define process ('cics. Pro') replace appltype (CICs) applicid ('test ')

------------------------------------
In the Remote Queue Manager (qmb:
* Echo "change the dead message queue to deadq"
Alter qmgr deadq ('destadq') trigint (10000)

* Echo "define Remote Queue"
Define qremote ('qa') defpsist (yes) xmitq ('qma') rname ('qla') rqmname ('qma') replace

* Echo "defines the dead message queue"
Define qlocal ('deadq') defpsist (yes) maxdepth (20000) maxmsgl (4194304) replace

* Echo "defining local receiving queues"
Define qlocal ('qlb') defpsist (yes) maxdepth (100000) maxmsgl (1048576) trigger trigtype (first) process ('cics. pro') initq ('System. CICs. initiation. queue ') replace

* Echo "define transmission queue"
Define qlocal ('qm') defpsist (yes) maxdepth (100000) maxmsgl (1048576) usage (xmitq) trigger trigtype (first) trigdata ('B. a') initq ('System. channel. initq ') replace

* Echo "modifying system. CICs. Initiation. Queue queue attributes"
Alter qlocal ('System. CICs. Initiation. Queue ') descr ('websphere MQ default CICs initiation queue') defpsist (yes) maxdepth (100000) maxmsgl (1000)

* Echo "defines the receiving channel"
Define channel ('A. B ') chltype (rcvr) trptype (TCP) batchsz (50) hbint (300) mrrty (10) mrtmr (1000) replace

* Echo "defines the sending channel"
Define channel ('B. a') chltype (SDR) trptype (TCP) batchsz (50) conname ('2017. 168.10.222 ') discint (1800) hbint (300) longrty (999999999) longtmr (300) shortrty (10000) shorttmr (30) xmitq ('qma') replace
Define channel ('System. admin. svrconn') chltype (svrconn) trptype (TCP) hbint (300) maxmsgl (4194304) mcauser ('mqm') replace

* Echo "define the receiving process"
Define process ('cics. Pro') replace appltype (CICs) applicid ('test ')

 

The last step to connect two queue managers is to start the corresponding listening program locally and remotely. The port number is 1414.
Go to/etc/xinetd. conf (the path is unclear and can be found by FIND./-name amqcrsta ),
Edit the file:
Gedit/etc/xinetd. conf

Add the following content:
# D20080423
WebSphere MQ stream tcp Nowait MQM/opt/MQM/maintenance/6.0.2.2/mqseriesserver/backup/opt/MQM/bin/amqcrsta [-M queue_man_name]
# D20080423 end

In addition, you must modify the/etc/services file to open port 1414 to MQ (only root or super user can modify the file)
Add:
WebSphere Message Queue 1414/tcp # used by was MQ

To make the modification take effect, restart the xinet process.
Find this process
PS-elf | grep xinet

Kill it: Kill-9 788

Run the listener provided by WebSphere MQ:
Runmqlsr-M qmb-T TCP

Start xinetd (START | stop | status)
[Root @ P202 ~] # Service xinetd start

Test queue communication:
1. Switch to the MQ installation directory
2. Enter SAMP/bin
3. Execute amqsput q_name mqm_name to enter the sender
Amqsput QRB qma
4. Send messages
5. Execute amqsget q_name mqm_name to enter the receiver
Amqsget qlb qmb

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.