JmsGetReceivedMessageProperty Function

Action

Gets the header and message properties of the current message.

Include file

Jms.bdh

Syntax

JmsGetReceivedMessageProperty( sKey  : string,
                       iType : number optional ): string;
Parameter Description
sKey The name of the property. Can be a string or one of the following values:
  • JMS_MSG_HDR_CORRELATIONID: JMSCorrelationID
  • JMS_MSG_HDR_DELIVERYMODE: JMSDeliveryMode
  • JMS_MSG_HDR_EXPIRATION: JMSExpiration
  • JMS_MSG_HDR_MESSAGEID: JMSMessageID
  • JMS_MSG_HDR_PRIORITY: JMSPriority
  • JMS_MSG_HDR_REDELIVERED: JMSRedelivered
  • JMS_MSG_HDR_TIMESTAMP: JMSTimestamp
  • JMS_MSG_HDR_TYPE: JMSType
iType (Optional) The property type. Default is string.

Return value

Returns the given header or message property of the current message.

Example

  transaction TExampleUsingSelector
  var sMessage : string;
      sMessageId : string;
      sMessageSelector : string;
      sReturnType : number;
      hHandle : number;
  begin   
    JmsSetMessageSelector("MESSAGEID = '12345'", csQueue);
    
    JmsSetMessageProperty("MESSAGEID","12345");
    JmsSendTextMessage("Welcome1!", csQueue);
    JmsReceiveMessage(csQueue, 5000);
    sMessage := JmsGetMessageText();
    if (Strlen(sMessage) = 0) then
      RepMessage("ERR: Should have receive the message!", SEVERITY_ERROR);
    end;
    
    JmsClearMessage();
    JmsSendTextMessage("Welcome2!", csQueue);
    sReturnType := JmsReceiveMessage(csQueue, 5000);
    if sReturnType <> JMS_TIMEOUT then
      sMessage := JmsGetMessageText();
      sMessageId := JmsGetReceivedMessageProperty("MESSAGEID");
      sMessageSelector := JmsGetMessageSelector(csQueue);
      Print("Return type: " + string(sReturnType) + "; message text: " + sMessage + "; messageid: " + sMessageId + "; messageSelector: " + sMessageSelector);
      RepMessage("ERR: Should have not receive the message!", SEVERITY_ERROR);
    end;

    JmsSetMessageProperty("MESSAGEID","12345");
    JmsSendTextMessage("Welcome3!", csQueue);
    JmsReceiveMessage(csQueue, -1);
    JmsVerifyMessageText("Welcome3!");
  end TExampleUsingSelector;  

Sample scripts

JmsSample.bdf, JmsSample.java