Sidebar

How do I populate a message's ACK message from a mapping function?

0 votes
45 views
asked May 14 by david-f-5427 (1,660 points)
I see how, for example, a Web Service destination node can set an ACK message which shows up on a completed message's "Response Received" tab in the Message Detail dialog. Is there a way to set this ACK message from a mapping function?

1 Answer

0 votes

The "Response Received" tab can, for example, be populated when a Web Service destination node sets an ACK message. This same functionality and behavior is available via scripting, as follows:

message.setAckMessage('some ACK message');

 

There is an undocumented code wizard function that returns the message's ACK message or null, if there is no ACK message (NOTE: this method will be documented beginning with QIE version 24.2.1):

message.getAckMessage();

 

When a destination node sets an ACK message and there already is a previously-set ACK message, a warning is logged to the channel's status log stating something like:

Discarded prior ACK: some previous ACK message

 

This same functionality can be achieved using these two ACK message functions inside a custom script, for example:

var priorAckMessageOrNull = message.getAckMessage();

if (priorAckMessageOrNull != null) {
  qie.warn(
    'Discarded prior ACK:\n\n' + 
    new java.lang.String(priorAckMessageOrNull)
  );
}

message.setAckMessage('new ACK message');

 

NOTE: the setter takes either a String or a byte array. The getter returns only a byte array. As seen in the preceding example, a quick way to turn that byte array into a string is to create a new java.lang.String instance by passing in the return value of message.getAckMessage().

answered May 14 by david-f-5427 (1,660 points)
...