MQQueue class

This represents access to a WebSphere MQ queue. This connection is provided by an associated MQQueueManager object. When an object of this class is destroyed it is automatically closed.

Containment

Contained by the MQQueueManager class.

Creation

New creates a new MQQueue object and sets all the properties to initial values. Alternatively, use the AccessQueue Method of the MQQueueManager class.

Syntax

Dim que As New MQQueue
Set que = New MQQueue

Properties

Methods

Property Access

If the queue object is not connected to a queue manager, you can read the following properties:

and you can read and write to:

If the queue object is connected to a queue manager, you can read all the properties.

Queue Attribute properties

Properties not listed in the previous section are all attributes of the underlying WebSphere MQ queue. They can be accessed only if the object is connected to a queue manager, and the user's user ID is authorized for Inquire or Set against that queue. If an alternate user ID is set and the current user ID is authorized to use it, the alternate user ID is checked for authorisation instead.

The property must be an appropriate property for the given QueueType. See the WebSphere MQ Application Programming Reference manual.

If these conditions do not apply, the property access will set a CompletionCode of MQCC_FAILED and one of the following ReasonCodes:

Opening a queue

The only way to create an MQQueue object is by using the MQQueueManager AccessQueue method or by New. An open MQQueue object remains open (OpenStatus=TRUE) until it is closed or deleted or until the creating queue manager object is deleted or connection is lost to the queue manager. The value of the MQQueue CloseOptions property controls the behavior of the close operation that takes place when the MQQueue object is deleted.

The MQQueueManager AccessQueue method opens the queue using the OpenOptions parameter. The MQQueue.Open method opens the queue using the OpenOptions property. WebSphere MQ validates the OpenOptions against the user authorization as part of the open queue process.

AlternateUserId property

Read-write. The alternate user ID used to validate access to the queue when it is opened.

This property cannot be set while the object is open (that is, when IsOpen is TRUE).

Defined in: MQQueue class

Data Type: String of 12 characters

Syntax:
To get: altuser$ = MQQueue.AlternateUserId

To set: MQQueue.AlternateUserId = altuser$

BackoutRequeueName property

Read-only. The MQI BackOutRequeueQName attribute.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: backoutrequeuename$ = MQQueue.BackoutRequeueName

BackoutThreshold property

Read-only. The MQI BackoutThreshold attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: backoutthreshold& = MQQueue.BackoutThreshold

BaseQueueName property

Read-only. The queue name to which the alias resolves.

Valid only for alias queues.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: baseqname$ = MQQueue.BaseQueueName

CloseOptions property

Read-Write. Options used to control what happens when the queue is closed.

Defined in: MQQueue class

Data Type: Long

Values:

MQCO_DELETE and MQCO_DELETE_PURGE are valid only for dynamic queues.

Syntax:
To get: closeopt& = MQQueue.CloseOptions

To set: MQQueue.CloseOptions = closeopt&

CompletionCode property

Read-only. Returns the completion code set by the last method or property access issued against the object.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: completioncode& = MQQueue.CompletionCode

ConnectionReference property

Read-write. Defines the queue manager object to which a queue object belongs. The connection reference cannot be written while a queue is open.

Defined in: MQQueue class

Data Type: MQQueueManager

Values:

Syntax:
To set: set MQQueue.ConnectionReference = ConnectionReference

To get: set ConnectionReference = MQQueue.ConnectionReference

CreationDateTime property

Read-only. Date and time this queue was created.

Defined in: MQQueue class

Data Type: Variant of type 7 (date/time) or EMPTY

Syntax:
To get: datetime = MQQueue.CreationDateTime

CurrentDepth property

Read-only. The number of messages currently on the queue.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: currentdepth& = MQQueue.CurrentDepth

DefaultInputOpenOption property

Read-only. Controls the way that the queue is opened if the OpenOptions specify MQOO_INPUT_AS_Q_DEF.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: defaultinop& = MQQueue.DefaultInputOpenOption

DefaultPersistence property

Read-only. The default persistence for messages on a queue.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: defpersistence& = MQQueue.DefaultPersistence

DefaultPriority property

Read-only. The default priority for messages on a queue.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: defpriority& = MQQueue.DefaultPriority

DefinitionType property

Read-only. Queue definition type.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: deftype& = MQQueue.DefinitionType

DepthHighEvent property

Read-only. The MQI QDepthHighEvent attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: depthhighevent& = MQQueue.DepthHighEvent

DepthHighLimit property

Read-only. The MQI QDepthHighLimit attribute.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: depthhighlimit& = MQQueue.DepthHighLimit

DepthLowEvent property

Read-only. The MQI QDepthLowEvent attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: depthlowevent& = MQQueue.DepthLowEvent

DepthLowLimit property

Read-only. The MQI QDepthLowLimit attribute.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: depthlowlimit& = MQQueue.DepthLowLimit

DepthMaximumEvent property

Read-only. The MQI QDepthMaxEvent attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: depthmaximumevent& = MQQueue.DepthMaximumEvent

Description property

Read-only. A description of the queue.

Defined in: MQQueue class

Data Type: String of 64 characters

Syntax:
To get: description$ = MQQueue.Description

DynamicQueueName property

Read-write, read-only when the queue is open.

This controls the dynamic queue name used when a model queue is opened. It may be set with a wildcard by the user either as a property set (only when the queue is closed) or as a parameter to MQQueueManager.AccessQueue().

The actual name of the dynamic queue is found by querying QueueName.

Defined in: MQQueue class

Data Type: String of 48 characters

Values:

Syntax:
To set: MQQueue.DynamicQueueName = dynamicqueuename$

To get: dynamicqueuename$ = MQQueue.DynamicQueueName

HardenGetBackout property

Read-only. Whether to maintain an accurate back-out count.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: hardengetback& = MQQueue.HardenGetBackout

InhibitGet property

Read-write. The MQI InhibitGet attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: getstatus& = MQQueue.InhibitGet

To set: MQQueue.InhibitGet = getstatus&

InhibitPut property

Read-write. The MQI InhibitPut attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: putstatus& = MQQueue.InhibitPut

To set: MQQueue.InhibitPut = putstatus&

InitiationQueueName property

Read-only. Name of initiation queue.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: initqname$ = MQQueue.InitiationQueueName

IsOpen property

Read-only. Returns whether or not the queue is open.

Defined in: MQQueue class

Data Type: Boolean

Values:

Syntax:
To get: open = MQQueue.IsOpen

MaximumDepth property

Read-only. Maximum queue depth.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: maxdepth& = MQQueue.MaximumDepth

MaximumMessageLength property

Read-only. Maximum permitted message length in bytes for this queue.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: maxmlength& = MQQueue.MaximumMessageLength

MessageDeliverySequence property

Read-only. Message delivery sequence.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: messdelseq& = MQQueue.MessageDeliverySequence

Name property

Read-write. The MQI Queue attribute. This property cannot be written after the MQQueue is open.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: name$ = MQQueue.name

To set: MQQueue.name = name$

Note:
Visual Basic reserves the "Name" property for use in the visual interface. Therefore, when using within Visual Basic use lower-case, that is "name".

ObjectHandle property

Read-only. The object handle for the WebSphere MQ queue object.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: hobj& = MQQueue.ObjectHandle

OpenInputCount property

Read-only. Number of opens for input.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: openincount& = MQQueue.OpenInputCount

OpenOptions property

Read-write. Options to be used for opening the queue.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: openopt& = MQQueue.OpenOptions

To set: MQQueue.OpenOptions = openopt&

OpenOutputCount property

Read-only. Number of opens for output.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: openoutcount& = MQQueue.OpenOutputCount

OpenStatus property

Read-only. Indicates if the queue is opened or not. Initial value is TRUE after AccessQueue method or FALSE after New.

Defined in: MQQueue class

Data Type: Boolean

Values:

Syntax:
To get: status& = MQQueue.OpenStatus

ProcessName property

Read-only. The MQI ProcessName attribute.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: procname$ =MQQueue.ProcessName

QueueManagerName property

Read-write. The WebSphere MQ queue manager name.

Defined in: MQQueue class

Data Type: String

Syntax:
To get: QueueManagerName$ = MQQueue.QueueManagerName

To set: MQQueue.QueueManagerName = QueueManagerName$

QueueType Property

Read-only. The MQI QType attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: queuetype& = MQQueue.QueueType

ReasonCode property

Read-only. Returns the reason code set by the last method or property access issued against the object.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: reasoncode& = MQQueue.ReasonCode

ReasonName property

Read-only. Returns the symbolic name of the latest reason code. For example, "MQRC_QMGR_NOT_AVAILABLE".

Defined in: MQQueue class

Data Type: String

Values:

Syntax:
To get: reasonname$ = MQQueue.ReasonName

RemoteQueueManagerName property

Read-only. Name of remote queue manager. Valid for remote queues only.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: remqmanname$ = MQQueue.RemoteQueueManagerName

RemoteQueueName property

Read-only. The name of the queue as it is known on the remote queue manager. Valid for remote queues only.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: remqname$ = MQQueue.RemoteQueueName

ResolvedQueueManagerName property

Read-only. The name of the final destination queue manager as known to the local queue manager.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: resqmanname$ = MQQueue.ResolvedQueueManagerName

ResolvedQueueName property

Read-only. The name of the final destination queue manager as known to the local queue manager.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: resqmanname$ = MQQueue.ResolvedQueueName

RetentionInterval property

Read-only. The period of time for which the queue should be retained.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: retinterval& = MQQueue.RetentionInterval

Scope property

Read-only. Controls whether an entry for this queue also exists in a cell directory.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: scope& = MQQueue.Scope

ServiceInterval property

Read-only. The MQI QServiceInterval attribute.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: serviceinterval& = MQQueue.ServiceInterval

ServiceIntervalEvent property

Read-only. The MQI QServiceIntervalEvent attribute.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: serviceintervalevent& = MQQueue.ServiceIntervalEvent

Shareability property

Read-only. Queue shareability.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: shareability& = MQQueue.Shareability

TransmissionQueueName property

Read-only. Transmission queue name. Valid for remote queues only.

Defined in: MQQueue class

Data Type: String of 48 characters

Syntax:
To get: transqname$ = MQQueue.TransmissionQueueName

TriggerControl property

Read-write. Trigger control.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: trigcontrol& = MQQueue.TriggerControl

To set: MQQueue.TriggerControl = trigcontrol&

TriggerData property

Read-write. Trigger data.

Defined in: MQQueue class

Data Type: String of 64 characters

Syntax:
To get: trigdata$ = MQQueue.TriggerData

To set: MQQueue.TriggerData = trigdata$

TriggerDepth property

Read-write. The number of messages that have to be on the queue before a trigger message is written.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: trigdepth& = MQQueue.TriggerDepth

To set: MQQueue.TriggerDepth = trigdepth&

TriggerMessagePriority property

Read-write. Threshold message priority for triggers.

Defined in: MQQueue class

Data Type: Long

Syntax:
To get: trigmesspriority& = MQQueue.TriggerMessagePriority

To set: MQQueue.TriggerMessagePriority = trigmesspriority&

TriggerType property

Read-write. Trigger type.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: trigtype& = MQQueue.TriggerType

To set: MQQueue.TriggerType = Trigtype&

Usage property

Read-only. Indicates what the queue is used for.

Defined in: MQQueue class

Data Type: Long

Values:

Syntax:
To get: usage& = MQQueue.Usage

ClearErrorCodes method

Resets the CompletionCode to MQCC_OK and the ReasonCode to MQRC_NONE for both the MQQueue class and the MQSession class.

Defined in: MQQueue class

Syntax:
Call MQQueue.ClearErrorCodes()

Close method

Closes a queue using the current values of CloseOptions.

Defined in: MQQueue class

Syntax:
Call MQQueue.Close()

Get method

Retrieves a message from the queue.

This method takes an MQMessage object as a parameter. It uses some of the fields in this object's MQMD as input parameters - in particular the MessageId and CorrelId, so it is important to ensure that these are set as required. See the WebSphere MQ Application Programming Reference for details.

If the method fails then the MQMessage object is unchanged. If it succeeds then the MQMD and Message Data portions of the MQMessage object are completely replaced with the MQMD and Message Data from the incoming message. The MQMessage control properties are set as follows

Defined in:
MQQueue class

Syntax:
Call MQQueue.Get(Message, GetMsgOptions, GetMsgLength)

Parameters
Message:

MQMessage Object representing message to be retrieved.

GetMsgOptions:

Optional MQGetMessageOptions object to control the get operation. If these are not specified, default MQGetMessageOptions are used.

GetMsgLength:

Optional 2- or 4-byte length value to control the maximum length of the WebSphere MQ message that will be retrieved from the queue.

If the MQGMO_ACCEPT_TRUNCATED_MSG option is specified, the GET succeeds with a completion code of MQCC_WARNING and a reason code of MQRC_TRUNCATED_MSG_ACCEPTED if the message size exceeds the specified length.

The MessageData holds the first GetMsgLength bytes of data.

If MQGMO_ACCEPT_TRUNCATED_MSG is not specified, and the message size exceeds the specified length, the completion code of MQCC_FAILED together with reason code MQRC_TRUNCATED_MESSAGE_FAILED is returned.

If the contents of the message buffer are undefined, the total message length is set to the full length of the message that would have been retrieved.

If the message length parameter is not specified, the length of the message buffer is automatically adjusted to at least the size of the incoming message.

Open method

Opens a queue using the current values of:

  1. QueueName
  2. QueueManagerName
  3. AlternateUserId
  4. DynamicQueueName

Defined in:
MQQueue class

Syntax:
Call MQQueue.Open()

Put method

Places a message onto the queue.

This method takes an MQMessage object as a parameter. The Message Descriptor (MQMD) properties of this object may be altered as a result of this method. The values they have immediately after this method has run are the values that were put onto the WebSphere MQ.

Modifications to the MQMessage object after the Put has completed do not affect the actual message on the WebSphere MQ queue.

Defined in:
MQQueue class

Syntax:
Call MQQueue.Put(Message, PutMsgOptions)

Parameters
Message

MQMessage object representing message to be put.

PutMsgOptions

MQPutMessageOptions object containing options to control the put operation. If these are not specified, default PutMessageOptions are used.



© IBM Corporation 2002. All Rights Reserved