Topic
2 replies Latest Post - ‏2012-11-12T02:49:38Z by fjb_saper
Keshav1980
Keshav1980
5 Posts
ACCEPTED ANSWER

Pinned topic Correlation id not getting assigned

‏2012-10-29T22:40:25Z |
Hi,
WSMB V7.
WCS --> MQ Queue --> Compute --> SAP Adapter --> Compute --> MQ Queue --> WCS
In a message flow, I am trying to assign message id from request (in MQ Queue) to correlation id from response (in response MQ Queue) using esql compute pasted below. But correlation id is not assigned as seen in MQ explorer. Please provide your inputs. Thank you

Declare MsgId2 SHARED CHAR 'xyz';

CREATE COMPUTE MODULE ABC_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN
Set MsgId2 = substring(cast(InputRoot.MQMD.MsgId as Char) from 3 for 48);
SET OutputRoot = InputRoot;
END;
END MODULE;
CREATE COMPUTE MODULE ABC_Compute1
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.MQMD.CorrelId = cast(MsgId2 as BLOB);
CALL CopyEntireMessage();
RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
Updated on 2012-11-12T02:49:38Z at 2012-11-12T02:49:38Z by fjb_saper
  • Keshav1980
    Keshav1980
    5 Posts
    ACCEPTED ANSWER

    Re: Correlation id not getting assigned

    ‏2012-11-01T00:30:59Z  in response to Keshav1980
    This issue is fixed. All it needed was to interchange places of
    SET OutputRoot.MQMD.CorrelId = cast(MsgId2 as BLOB);
    CALL CopyEntireMessage();

    to

    CALL CopyEntireMessage();
    SET OutputRoot.MQMD.CorrelId = cast(MsgId2 as BLOB);
    • fjb_saper
      fjb_saper
      120 Posts
      ACCEPTED ANSWER

      Re: Correlation id not getting assigned

      ‏2012-11-12T02:49:38Z  in response to Keshav1980
      Sorry to say and disturb you, but the issue is not fixed.
      You can never treat a message id or correlation id as text as it is a byte array and as such contains values that cannot be represented as characters...

      You should also be looking at WrittenDestination in the LocalEnvironment!

      Happy coding