Home > Class Reference > ENSLIB namespace > %Net.abstractMQ

%Net.abstractMQ

abstract class %Net.abstractMQ extends %Library.RegisteredObject

 
The %Net.MQ class provides an interface to the IBM WebSphere MQ Series messaging product.  Two classes are provided, MQSend for sending messages to a queue, and MQRecv for picking up messages that have been queued.

Usage

An MQ object is created when an instance of an MQ class is created via %New. Following creation, the class can be assigned an error log file, and connected to an MQ Server.

The %Init() method is a simple way to perform both these functions.

For advanced applications, these steps can be performed via separate method calls.

To establish an error log file for the class, call %ErrLog().

A connection is established by calling the %Connect() method. The connection is maintained until you deallocate the instance. The instance must be successfully connected before it can be used for message queuing.

Use MQSend.%Put() to send messages to a queue.  Use MQRecv.%Get() to read messages from a queue.

All methods return 1 for success, 0 for failure. In case of a failure, the actual MQ error code is available via the method %GetLastError().

Charcter Set Translation

%CharSet(.ccs) Retrieves the Coded Character Set identifier. This value may be altered by the message system after an unsuccessful attempt to convert data in MQGet.

%SetCharSet(id) Sets the Coded Character Set identifier. Incoming messages will be converted to this character set. Outgoing message's character set encoding is identified to the message queue with this value.

For output (MQSend.%Put()), the Coded Character Set Id describes to the system the char set used for the message. If not set, the MQ system assumes the default character set for the MQ client.

For input (MQRecv.%Get()), the Coded Character Set Id indicates to the MQ client how the message should be converted. The conversion is done automatically during message reciept on the client.

Thus one may send messages in any encoding (notifying the system what the encoding used is), and receive messages converting from one encoding to another.

Example:

To convert a message encoded in EBCDIC (Character Coded Set Id 1047, indicating IBM-1047 coding), a user on a Windows system may wish to convert using code 437 (the default on Windows systems). Then the following will convert the EBCDIC message to ascii on the windows system:

Do mq.%SetCharSet(437) ;437 English ascii code on Windows

Do mq.%Get(.msg) ;converts the message to 437 code

MQ Documentation

Consult the IBM WebSphere MQ website for further documentation.
 
 

Property Inventory (Including Private)

Method Inventory (Including Private)

Parameters

parameter ApplIdentityData = 5;
parameter CorrelationId = 2;
parameter MessageId = 1;
parameter ReplyQMgrName = 3;
parameter ReplyQName = 4;

Properties (Including Private)

property ApplIdentityData as %String;
Message Descriptor Options: Application Identity
Property methods: ApplIdentityDataDisplayToLogical(), ApplIdentityDataGet(), ApplIdentityDataIsValid(), ApplIdentityDataLogicalToDisplay(), ApplIdentityDataLogicalToOdbc(), ApplIdentityDataNormalize(), ApplIdentityDataSet()
property Channel as %String;
Channel Definition Options: Channel Name
Property methods: ChannelDisplayToLogical(), ChannelGet(), ChannelIsValid(), ChannelLogicalToDisplay(), ChannelLogicalToOdbc(), ChannelNormalize(), ChannelSet()
property CharSetId as %Integer;
Message Descriptor Options: Character Set Identifier
Property methods: CharSetIdDisplayToLogical(), CharSetIdGet(), CharSetIdIsValid(), CharSetIdLogicalToDisplay(), CharSetIdNormalize(), CharSetIdSet()
property Connection as %String;
Channel Definition Options: Connection name
Property methods: ConnectionDisplayToLogical(), ConnectionGet(), ConnectionIsValid(), ConnectionLogicalToDisplay(), ConnectionLogicalToOdbc(), ConnectionNormalize(), ConnectionSet()
property Context as %Integer [ InitialExpression = 0 ];
Flag indicating use of message context 0 - DEFAULT, 1 - IDENTITY, 2 - ALL
Property methods: ContextDisplayToLogical(), ContextGet(), ContextIsValid(), ContextLogicalToDisplay(), ContextNormalize(), ContextSet()
property CorrelationId as %String;
Message Descriptor Options: Correlation Id
Property methods: CorrelationIdDisplayToLogical(), CorrelationIdGet(), CorrelationIdIsValid(), CorrelationIdLogicalToDisplay(), CorrelationIdLogicalToOdbc(), CorrelationIdNormalize(), CorrelationIdSet()
property MessageId as