correlationID

Type: Binary

The correlationID property of the JadeGenericMessage class contains an identifier used to associate a reply message with the corresponding request message.

When a reply message is built, the correlationID property of the reply message is set to the messageID property of the request message. When the reply is received, the correlationID property identifies the request message previously sent.

The correlationID property cannot be set after calling the beginMessage or putMessage method of the JadeGenericQueue class.

In the following method example, a request message is sent and a reply is received.

request();
vars
    msg : JadeGenericMessage;
    corrID : Binary;
begin
    msg := myRequestQueue.createMessage(true);
    msg.replyQueueFullName := myReplyQueue.fullName;
    msg.appendString("What is the meaning of life?");
    myRequestQueue.putMessage(msg, null);
    corrID := msg.messageID;
    msg.initializeForGet;
    myReplyQueue.getMessageByCorrelationID(msg, "", corrID);
    write msg.body.String;                                 // writes "42"
epilog
    delete msg;
end;

In the following method example, a request message is received and a reply is sent.

reply();
vars
    get : JadeGenericMessage;
    put : JadeGenericMessage;
    replyQueue : JadeGenericQueue;
    factory : JadeMessagingFactory;
begin
    get := myQueue.createMessage(false);
    myQueue.getMessage(get, null);
    create factory transient;
    replyQueue := factory.openQueue(get.replyQueueFullName, 
                                    "Access=Public;Usage=Put");
    replyQueue.inspectModal;
    put := replyQueue.createMessage(true);
    put.correlationID := get.messageID;
    put.appendString("42");
    replyQueue.putMessage(put, null);
epilog
    delete get;
    delete put;
    delete factory;
    delete replyQueue;
end;

As some transports such as WebSphere have correlationID values with trailing null characters that are part of the correlationID, you should not store correlationID values in fixed-length Binary variables.