JmsSetConsumerMessageListener Function

Action

Attaches a listener for the given destination.

Include file

Jms.bdh

Syntax

JmsSetConsumerMessgaeListener( in sJndiDestinationName : string, 
                                  hHandle              : number );
Parameter Description
sJndiDestinationName The destination for which you want to attach the listener
hHandle The handle of the listener

Example

  transaction TExampleGetMessageAsynchronously
  var hHandle : number;
  begin
    JavaCallMethod(ghJmsSampleObj, "getMessageListener");        
    hHandle := JavaGetObject(ghJmsSampleObj);

    JmsSetConsumerMessageListener(csQueue, hHandle);
    JmsClearMessage();
    JmsSendTextMessage("Text message 1 for the message listener!", csQueue); 
    JmsSendTextMessage("Text message 2 for the message listener!", csQueue); 
    JmsSendTextMessage("Text message 3 for the message listener!", csQueue); 
    if (JmsGetConsumerMessageListener(csQueue) = 0) then
      RepMessage("No message listener set for " + csQueue, SEVERITY_WARNING);
    else
      // We have to wait for the 3 messages to get to the listener
      Wait 5.0;  
    end;
  end TExampleGetMessageAsynchronously;  

Sample scripts

JmsSample.bdf, JmsSample.java