sendNACK

Declaration

void sendNACK(S7RClientSSjToken token, int ReasonCode) throws S7RClientSSjException.

Purpose

This method will send a "nack" event back to the Substation ES based on a indicator in the current input data that the Substation ES wants explicit acknowledgement. The "Correlation Id" of the current input data is copied to the "ack" event. A "nack" means the input data has NOT been processed or persisted and that the resource on the Substation ES should be rolled back(see conn.sendACK).
Note: If the current S7R data does not require an explicit ack/nack, then the method is ignored. If a previous sendACK or sendNACK for the current S7R input data was sent, then this method is ignored.

Parameters

Parameter Description
token The S7RClientSSjToken returned by Connect method.
type The ServiceType - either ServiceType.Recipe or ServiceType.Trigger.
service_name String with value of service name (max length is 127 characters).

Return

The method does not return any value when the acknowledgment is successful.

Errors

  • S7RClientSSjException: If a "nack" event cannot be delivered to Substation ES.

Example

S7RClientSSj conn = new S7RClientSSj();
S7RClientSSjToken token = conn.Connect(url, userid, password);
conn.setAutoAck(token, false);  // user will handle ack/nack process
conn.setTimeout(token, 10*1000);  // set 10 second timeout on gets
byte[] dataIn = conn.receiveWait(token);
if (dataIn != null) {
  dataIn = conn.getDataContent(token);  
  	processing problem
  conn.sendNACK(token);
}
conn.Disconnect(token);