2007年12月15日 星期六

[MQueue] IBM WMQ Configuration for Distributed Queuing

.
. IBM WebSphere MQ v6.0
. Chapter 5.1 IBM WMQ Configuration for Distributed Queuing.
.

=== Identifying a Queue in the MQI ===
1. A Queue is identified by :
 - The name of the Queue.
 - The name of the Queue Manager which owns the Queue.
2. A Queue may be referenced in two places :
 - Object descriptor, on an MQOPEN or MQPUT1 call.
  a. ObjectName
  b. ObjectQMgrName
 - Message descriptor, to specify a reply-to Queue.
  a. ReplyToQ
  b. ReplyToQMgr
3. In an object descriptor, if ObjectQMgrName is blank, the Queue with the
 name specified in ObjectName must be defined in one of the following places :
 - The Local Queue Manager.
 - The name service.


=== Assured Delivery ===
1. Whether an application is putting a message on a Local Queue or to a Remote Queue
 is transparent to the applcation.
2. However, an application always gets a message from a Local Queue.




=== Queue Definitions for Distributed Queuing ===
1. Local definition of a Remote Queue (Remote Local Queue) :
  DEFINE QREMOTE(BBB) RNAME(YYY) RQMNAME(QM2)
2. A Transmission Queue must be created at the SENDing end of each message channel :
 - USAGE(XMITQ) indicates its purpose.
 - Otherwise, it may have any of the attributes of a Local Queue.
  DEFINE QLOCAL(QM2) USAGE(XMITQ)
3. As usual, give a Transmission Queue the same name as the Remote Queue Manager.
(只有SENDER端有XMIQ,且通常命名為要傳送那端的QM)

※ 所以想要建立一個 Remote Queue ,必須提供:
1. RQ Name
2. Remote Local Q Name
3. Remote QM Name
4. XMITQ


※ 對應的 Channel :
1. CHLTYPE - Channel Type
2. (SDR) Connection Name
3. XMITQ (與上面的XMIT串接)


=== Message Channel combinations ===
1. A sender can initiate a communications connection with a receiver and then sned message to it. This is the most common combination. A fully defined server may also perform the same role as a sender in this combination.
 QM1 [ SENDER (SERVER) ] → 開connection → [RECEIVER] QM2
                ↘→ 送 messages →↗

2. A requester can initiate a communications connection with a server which then sends messages to the same requester. 
 QM1 [ REQUESTER ] → 開connection(REQ) → [SERVER (channel) ]
         ↖←←←←← 送messages ←←←←←↙
3. A requester can initiate a communications connection with a sender which promptly terminates the connection. The sender then starts a communications connection according to the information in its Channel definition and sends messages to the partner it has started. This combination is know as callback.
 QM1 [REQUESTER ] → (REQ) → [ SENDER ]
                   ↙
   QM3 [RECEIVER] ←Callback←↙



※ 與Client Channel不同點 : SVRCONN, 是client的方式連上.


=== Attributes of a Message Channel ===
1. Required for definition :
 - Channel-Name   (Up to 20 characters)
 - CHLTYPE     SDR, RCVR, SVR, RQSTR, SVRCONN
 - TRTYPE      DESNET, LU62, NETBIOS, SPX, TCP(default)
 - CONNAME(string)  (for SDR and RQSTR only, optional for SVR)
 - XMITQ(string)    (for SDR and SVR only)

※ TRTYPE 預設為 TCP,可省略.
※ CONNAME('127.0.0.1(1414)') 或 CONNAME(host) 亦可,預設 1414 port

2.Required for SNA LU6.2 :
 - MODENAME(string)
 - TPNAME(string)

※ The WebSphere MQ command to define a message channel at one end is :
 - DEFINE CHANNEL
 - ALTER CHANNEL
 - DISPLAY CHANNEL
 - DELETE CHANNEL

※ Attribute not supplied on the DEFINE CHANNEL command are taken from the appropriate default channel object.
 - SYSTEM.DEF.SENDER
 - SYSTEM.DEF.RECEIVER
 - SYSTEM.DEF.SERVER
 - SYSTEM.DEF.REQUESTER


=== DEFINE CHANNEL Example ===
[ QMAA ]
S.1 DEF CHL('QMA_QMB') CHLTYPE(SDR) TRPTYPE(TCP) +
   CONNAME(host1) XMITQ('QMB')

S.2 DEF QL(QMB) USAGE(XMITQ)

S.3 DEF CHL('QMB_QMA') CHLTYPE(RCVR) TRTYPE(TCP)
--- --- --- --- --- ---
[ QMBB ]
R.1 DEF CHL('QMA_QMB') CHLTYPE(RCVR) TRPTYPE(TCP)

R.3 DEF CHL('QMB_QMA') CHLTYPE(SDR) TRPTYPE(TCP) +
   CONNAME(host2) XMITQ('QMA')

R.4 DEF QL('QMA') USAGE(XMITQ)
--- --- --- --- --- ---


=== Choosing a Transmission Queue ===
1. A Local definition of a Remote Queue can specify :
  DEFINE QREMOTE(BBB) RNAME(YYY) RQMNAME(QM2) XMITQ('Express')
2. The name of the Transmission Queue is inferred from the name of the Remote Queue Manager.
3. A default Transmission Queue can be specified by an attribute of the Queue Manager object.
  ALTER QMGR DEFXMITQ(HOST)
4. Error - the MQOPEN fails.


=== Configuring TCP/IP for WebSphereMQ ===
1. [UNIX/Linux] configure the inet daemon, inetd,...
 - /etc/services :
  MQSeries 1414/tcp      # MQSeries Channel Listener
 - /etc/inetd.conf
  WebSphereMQ stream tcp nowait root /usr/mqm/bin/amqcrsta amqcrsta -m QM
  or
  WebSphereMQ stream tcp nowait mqm /opt/mqm/bin/amqcrsta amqcrsta -m QM

 ※ The inet daemon then has to be refreshed.
  - AIX issue # refresh -s inetd
  - HP-UX issue # inetd -c

2. may use the WebSphereMQ Listener, runmqlsr

 ※ The WebSphereMQ command START LISTENER can also be used to start the Listener.
   On iSeries, UNIX Systems and Windows, this command is valid for CHANNELs
   for which TRTYPE is TCP.


=== Starting a Message Channel ===
1. WebSphereMQ commands :
 - PING CHANNEL(QMA_QMB)
 - START CHANNEL(QMA_QMB)
2. Control command :
 - # runmqchl -c QMA_QMB
3. Channel attributes compared :
 - BATCHSZ   (default=50, 若兩邊channel大小不同,以小的為準)
 - MAXMSGL   (也是以小的為準)
 - SEQWRAP   (counter, default=999999999, 必須一致)
 - HBINT     (HeatBeat interval)
 - NPMSPEED  (Non-Persistence, Fast or Normal)

If the SEQWRAP value on a SENDER CHANNEL is different from the value on the RECEIVER,
  what will happen ? => The CHANNEL will not start.
NPMSPEED(FAST) is a parameter on a CHANNEL that causes the message CHANNEL agent to use
  MQGMO_SYNCPOINT_IF_PERSISTENT
CURSEQNO(3)必須一致,但有時不Sync,就必須RESET CHANNEL,清為0
INDOUBT(NO)為正常,若為YES,就必須RESOLVE CHANNEL( ) ACTION COMMITBACKOUT
A sender CHANNEL is defined in a script file with REPLACE.
  The runmqsc control command is run using this script while the CHANNEL is active.
  => The CHANNEL will fail and won't restart without intervention.


=== CHANNEL Initiator === (此為舊的機制)
The CHANNEL Initiator is a special trigger monitor for starting a message channel. It also contains retry logic for use in case of difficulty in starting a channel or after an error on a channel.
1. START CHINIT INITQ('Channel.InitQ')
 Trigger monitor for Trainsmission Queues :
  - Starts an MCA at the sending end of a message channel.
  - UserData attribute of the process object specifies the Channel name.
  - Or, TrigData attribute of the Transmission queue specifies the channel name.
2. Also a control command :
 # runmqchi -q Channel.InitQ
3. Channel control parameters :
 - DISCINT (SDR and SVR)
  (Max time to wait for a message on the Transmission Queue, if it is empty.
  If no message arrives whin this time, the channel closes down.)
 - SHORTRTY, SHORTTMR (SDR and SVR)
  (Short retry count and shot retry time interval to control repeated attempts to
  establish a communications connection.)
 - LONGRTY, LONGTMR (SDR and SVR)
 - MRRTY, MRTMR (RCVR and RQSTR)
  (Message-retry count and message-retry interval when attempting to
  put a message on a distination queue.
  If every attempt fails, the MCA decides that it cannot deliver the message.)
 - MCATYPE (SDR, SVR and RQSTR)
  (The value of this parameter may be THREAD or PROCESS.
  If THREAD is specified, each channel runs a thread within the CHANNEL Initiator process.
  If PROCESS is specified, each channel runs as a separate process.)
 - BATCHINT (SDR and SVR)
  (The period of time during which a channel will keep a batch open
  if there are no messages on the Transmission Queue.
  This should be set to a value considerably less than the value of DISCINT)


=== Channel Status ===
1. The current state of a channel can be determined by using the WebSphereMQ command :
 DISPLAY CHSTATUS


=== Queue Manager Alias ===
1. A Default Transmission Queue allows a message to be delivered through multiple Queue Managers
 [QMC] ←→ □□□□□□    □□□□□□  ←→ [QME]
        □ QMA □ ←→ □ QMB □
 [QMD] ←→ □□□□□□    □□□□□□ ←→ [QMF]

2. A Queue Manager Alias may also be needed :
 - for example, in QMA :
  DEFINE QREMOTE(QMF) RQMNAME(QMF) XMITQ(QMB)

※ Multi-Hopping :
 - 可克服 firewall 限制考量.
 - 可克服轉碼問題 ->[819]--->RCVR channel[1208 ]SDR channel--->[950]->


=== Separating Message Flows ===
  QM1                         QM2
 □□□□□□□□□□□□        □□□□□□□□□□□□□
 □        QM2□→→→→→→→→ □           □
 □           □←←←←←←←← □QM1        □
 □ [X] →→→→ QM2A □→→→→→→→→ □ →→→→ QL.SERV  □
 □  QL.REPLY ←←←□←←←←←←←← □ QM1A ←←←← [Y]  □
 □□□□□□□□□□□□        □□□□□□□□□□□□□


1. Local Def. of Remote Q :
 DEF QR(QR.SERV) RNAME(QSERVE) RQMNAME(QM2) XMITQ(QM2A)
2. Reply_to_Q Alias :
 DEF QR(QR.REPLY) RNAME(QL.REPLY) RQMNAME(QM1)
3. QM alias (Reply Msg) :
 DEF QR(QM1A) RQMNAME(QM1)

沒有留言:

張貼留言