JmsReceiveMessage Function

Action

Receives the first message from the given destination and returns the message type.

Include file

Jms.bdh

Syntax

JmsReceiveMessage( sJndiDestinationName :  string, 
                   lTimeout             :  number, 
                   sMeasureName         :  string optional ): number;
Parameter Description
sJndiDestinationName The source of the message
ITimeout The timeout value (in milliseconds). < 0 - wait forever, 0 - do not wait, > 0 - wait specified milliseconds
sMeasureName (optional) The name of this measure. Default is the method name.

Return value

Returns the message type
  • JMS_MSG_TYPE_TEXT := 0;
  • JMS_MSG_TYPE_BYTES := 1;
  • JMS_MSG_TYPE_MAP := 2;
  • JMS_MSG_TYPE_OBJECT := 3;
  • JMS_MSG_TYPE_STREAM := 4;
  • JMS_TIMEOUT := 5;
  • JMS_UNKNOWN := 6;

Example

transaction TExampleSendReceiveTextMessage
  var sRet : number;
      sMessage : string;
  begin
    JmsSendTextMessage("Welcome1!", csQueue);
    sRet := JmsReceiveMessage(csQueue, -1);
    if (sRet = JMS_MSG_TYPE_TEXT) then
      sMessage := JmsGetMessageText();
    else
      RepMessage("TextMessage expected!", SEVERITY_ERROR);
    end;      
  end TExampleSendReceiveTextMessage;

Sample scripts

JmsSample.bdf, JmsSample.java