2007年12月15日 星期六
.
. IBM WebSphere MQ v6.0
. Chapter 5.2 IBM MQ Administration in a Mixed Environment.
.
=== Three fields in the Message Descriptor ===
1. Encoding :
- Representation of the numeric data in the message.
- iSeries, Windows, and so forth
MQENC_NATIVE
2. CodedCharSetId :
- Representation of the character data in the message.
MQCCSI_Q_MGR
3. Format :
- Indicates the nature of the data in the message.
- Values MQ ... are reserved for WebSphereMQ
=== Requesting Application Data conversion ===
1. Request data conversion on the MQGET call :
- MQGMO_CONVERT
- Encoding and CodedCharSetId
a. On input, requested representation of the message.
b. On output, what the application actually receives.
- Conversion performed, if necessary, on the basis of what is contained in the Format field.
- A warning, and the message returned in its original form, if the conversion cannot be done.
2. Otherwise, request data conversion at the sending end of a message channel :
- CONVERT(YES)
- Unconverted messages are put on the Dead Letter Queue at the sending end.
=== What Application Data Conversion Can Be done ? ===
1. Some formats are built-in, and the data conversion is performed
by a built-in conversion routine :
- A message consisting entirely of characters.
- A message structure definedd by WebSphereMQ.
2. A user written data conversion exit is required when :
- The format of a message is defined by the application, not by WebSphereMQ.
- A message with a built-in format fails to convert.
3. There is a WebSphereMQ utility to help write a data conversion exit.
# crtmqcvx SourceFile TargetFile
※ Exit 掛勾 : —↓_↑—↓_↑—↓_↑—
- Security Exit
- Conversion Exit
- Compress Exit
- Message Exit
=== What Applications Should Do ===
1. Put messages with the following values in the Encoding and CodedCharSetId fields :
- MQENC_NATIVE (for native encoding)
- MQCCSI_Q_MGR (for the same CCSID as the Queue Manager)
2. Put all messages with a format name :
- MQFMT_STRING (for a message consisting entirely of characters)
3. Use the MQGMO_CONVERT option on the MQGET call :
- Check what is delivered by the call.
4. If necessary, use CONVERT(YES) at the sending end of a message channel.
=== Command Server === (MQ V6已經自動與QM啟動)
1. Command Queue :
- SYSTEM.ADMIN.COMMAND.QUEUE
- Messages contain Programmable Command Format (PCF) commands.
2. Command server process the messages in the Queue :
# strmqcsv QMgrName
# endmqcsv QMgrName (Ends the command server)
# dspmqcsv QMgrName (Displays the status of the command server)
3. Enables network administration applications :
- "Single point of control"
=== Support for PCF Commands ===
1. All Queue Managers have a command server which accepts PCF commands,
except :
- WebSphereMQ for z/OS Version 5
2. Administration utilities which issue PCF commands :
- SupportPacs for WebSphereMQ for UNIX, Linux and Windows.
- Vendor products.
- # runmqsc -w (indirect mode)
3. Application using the WebSphereMQ Administration Interface.
=== Program Example ===
1. Assume a utility to purge any Queues that have existed beyond their retention interval (賞味期...哈).
[ Application ] [ Command Server ]
MQPUT →→→→→→→→→→→→→→→→ MQGET
MQCMD_INQUIRE_Q Inquire attributes
- generic quene name of selected queues
MQGET ←←←←←←←←←←←←←←←← MQPUT
Determine which - Qname Response for each
queues have - RetentionInterval matching queue
expired, and for - CreationDate
each one ... - CreationTime
MQPUT →→→→→→→→→→→→→→→→ MQGET
MQCMD_DELETE_Q Delete named queue
- QueueName
=== Indirect Mode ===
1. Each WebSphereMQ command is sent within an Escape PCF command to the command Queue
of the named Queue Manager :
- Connects to the default Queue Manager.
- Escape PCF command processed at the target Qeueu Manager.
2. Waits for the replies :
- Time limit for the wait.
- Writes a report based on the replies received.
# runmqsc -w 5 QMgrName (WaitTime in seconds specifies the indirect mode)
3. Can also send a WebSphereMQ command to the system-command input Queue
of a z/OS Queue Manager.
- -x parameter
=== Instrumentation Events === 提供給Monitor程式用
1. Have a Queue Manager report a problem condition immediately :
- Number of messages on a Queue is increasing.
- Get requests are inhibited for a Queue.
- Message channel has stopped.
2. Enabled events are reort as event messages on event Queues :
- SYSTEM.ADMIN.QMGR.EVENT
- SYSTEM.ADMIN.PERFM.EVENT
- SYSTEM.ADMIN.CHANNEL.EVENT
- SYSTEM.ADMIN.CONFIG.EVENT (z/OS only)
- SYSTEM.ADMIN.COMMAND.EVENT (z/OS only)
- SYSTEM.ADMIN.LOGGER.EVENT (not z/OS)
=== Responding to an Instrumentation Event ===
1. Queue Manager events :
- Enable a Queue for put or get requests if it is not intentionally disabled.
- Corrent the authorizations for a Queue, or stop unauthorized users
trying to put messages on the Queue.
2. Performance events :
- Start a process to clear the backlog of messages.
- Syspend a process that is putting too many messages on a Queue.
3. Channel events :
- Restart a CHANNEL.
- Process the Dead Letter Queue.
4. Logger events :
- Archive unneeded log files.
=== Dead Letter Queue ===
1. When a problem relating to a message is detected asynchronously,
an exception report is generated if one has been requested
and the report is sent to the specified reply-to Queue.
2. The Feedback field in the message descriptor of the report message
indecates the reason for the report.
3. The original message is put on the Dead Letter Queue unless
MQRO_DISCARD_MSG is requested as a report option.
4. If a message cannot be delivered, it is put on the Dead Letter Queue
at the receiving end of a message CHANNEL, if one is defined.
5. Message-retry at the receiving end of a CHANNEL may be useful
if the problem is only temporary.
6. If CONVERT(YES) is specified in the CHANNEL definition at the sending end
of a message CHANNEL and a message cannot be converted,
the message is put on the Dead Letter Queue at the sending end.
7. If a message cannot be put on the Dead Letter Queue,
the CHANNEL is stopped and the message remains on the Transission Queue.
A fast non-persistent message, however, is just discarded in these circumstances
and the CHANNEL ramains open.
=== Dead Letter Queue Handler ===
1. Rules table contains a set of rules.
- Each rule consists of pattern matching keywords and an action.
- For each message on the Dead Letter Queue, each rule whose pattern
matches the message is attempted in turn.
- A message can be retried, forwarded, discarded or ingored.
- A message can be forwarded with, or without the dead letter header.
2. Can have multiple instances, each with a different rules table.
3. Source of a sample Dead Letter Queue handler is supplied as well.
# runmqdlq < Rules_Table
DESTQM(QM17) ACTION(FWD) FWDQ(&DESTQ) FWDQM(QM17A)
MSGTYPE(MQMT_REPORT) FEEDBACK(MQFB_EXPIRATION) ACTION(DISCARD)
REASON(MQRC_Q_FULL) ACTION(RETRY)
DESTQ(XYZ*) ACTION(FWD) FWDQ(XYZ_DEADQ) FWDQM(' ')
=== Using Dead Letter Queues ===
1. Create a Dead Letter Queue on all Queue Managers :
- Use message-retry on message CHANNELs for transient conditions.
- Consider "return to sender".
2. Use a Dead Letter Queue handler :
- Trigger when a message arrives on the Dead Letter Queue.
- Possibly attempt further retries.
- If unsuccessful, forward to an application Dead Letter Queue associated with :
a. The distination Queue.
b. The application specified by the PutApplName field in the message descriptor.
3. Don't allow an application Dead Letter Queue to become full.