NAME

MQSeries::Message::RulesFormat -- OO interface to the MQRFH Rules and Format message type

SYNOPSIS

use MQSeries;
use MQSeries::Message::RulesFormat;

DESCRIPTION

The MQSeries::Message::RulesFormat class is an interface to the Rules and Formats message structure, used by both the MQSeries Integrator 1.x product and the Publish/Subscribe broker.

METHODS

Since this class is a subclass of MQSeries::Message, all of the latters methods are availables as well as the following:

new

The constructor takes all of the same key/value pairs as the MQSeries::Message constructor, as well as the following additional keys:

Key			Value
===			=====
Header		HASH reference
Options		HASH reference
OptionsKeyPrefix	string

NOTE: The MsgDesc->Format string defaults to MQFMT_RF_HEADER automatically, and should not be specified. If it is overridden, then in all likelyhood you may experience problems with the applications (MQSI 1.x and the PubSub broker) that check the MQMD.Format. This should not be confused with the Header->Format, which specifies the format of the application data which appears in the message after the MQRFH structure.

The value of this key is a HASH reference representing the MQRFH header structure. See the docs for method of the same name below for more information.

Options

The value of this key is a HASH reference representing the MQRFH NameValue string. See the docs for method of the same name below for more information.

OptionsKeyPrefix

This species a fixed string which will prepended to all of the keys in the Options HASH when the NameValue string is generated, and likewise when the NameValue string is parsed, stripped.

This is used by MQSeries::PubSub::Message to strip the "MQPS" strings from the NameValue string keys, to simplify the way the PubSub API is coded. This is, of course, the authors subjective opinion, but thats why its fun to be the author.

Header

This method returns the HASH reference representing the MQRFH structure prepended to the NameValue string and application data in the message body. Note that this is NOT the MQMD, which is available via the standard MsgDesc method.

See the IBM documentation for the MQRFH structure for possible keys and values.

Note that in general, this can be almost be entirely omitted, as the default values for the MQRFH are usually sufficient. The values which a C or C++ application normally has to calculate, such as the "StrucLength", are handled by the perl API automatically.

The only field that usually needs to be specified is the "Format". If the Data portion of the message is a string, then this must be set to MQFMT_STRING, especially if character set conversion is expected to work.

When returned, all of the structure fields are present as keys in the HASH, with the exception of the "NameValueString" (which is not really part of the C structure anyway), which is available via the Options method.

Options

This method returns the HASH reference representing the data in the NameValue string which is appended to the MQRFH structure. The values for each key are either a string for non-repeated keys, or an ARRAY reference of strings for repeating fields.

For example, if the NameValue string in the MQRFH message was:

Key1 Value1 Key2 ValueA Key2 ValueB Key3 Value3

then the decoded HASH reference will be:

$options =
{
 Key1		=> "Value1",
 Key2		=> [ "ValueA", "ValueB" ],
 key3		=> "Value3",
}

Since the mapping is obviously reversible, the Options HASH passed to the object constructor would have the same stucture as that shown above.

SEE ALSO

MQSeries::Message(3), MQSeries::PubSub::Message(3)