swirl
Guide to OmniMark 9   OmniMark home
docs home 
 
  Related Topics   Other Library Functions  
function  

mq-get

 
 

Return type: String

Returns: A string containing the retrieved message body.


Declaration

define external stream function mq-get
  object               value   mq-object                object
  message-descriptor  value   mq-message-descriptor   MQMD
  get-options         value   mq-get-message-options  MQGMO
  length              value   integer                 max-length

Argument definitions

object
is a mq-object representing a connection to a queue.
MQMD
is a configured mq-message-descriptor object.
MQGMO
is a configured mq-get-message-options object.
length
is the maximum number of bytes in the message we want returned.


Purpose

Use mq-get to retrieve a message from an MQSeries queue.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "ommqi.xin"

The object must be open (else external exception OMMQI0013).

max-length must be greater than or equal to zero (else external exception OMMQI0014).

Usage Notes

This function corresponds to the MQPUT function in the MQSeries API.

The object parameter maps to both the Hconn and Hobj parameters of MQPUT.

The returned stream corresponds to the Buffer parameter of MQPUT.

The CompCode and Reason parameters of MQPUT are integrated into the OMMQI error handling.

Example

Connect to a queue and retrieve the first message.

  include "ommqi.xin"
  
  process
      local mq-connection       a-connection
      local mq-object               a-object
      local stream                 od-fields   variable
      local mq-object-descriptor   a-mqod
      local mq-message-descriptor  a-mqmd
      local mq-get-message-options a-mqgmo
      local stream                 message
  
      ; Connect to the MQSeries server using default values
      set a-connection to mq-connect
  
      ; Connect to the default queue on the server
      set new od-fields {"ObjectName"} to "default"
      mq-set-object-descriptor a-mqod to od-fields
      set a-object to mq-open connection           a-connection
                             object-descriptor a-mqod
                             options           MQOO_INPUT_AS_Q_DEF
  
      ; Get the first message in the queue, returning at most 1k of data
      set message to mq-get object              a-object
                            message-descriptor a-mqmd
                            get-options        a-mqgmo
                            length             1024

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.