Creating Acknowledgment Messages
If you want acknowledgment messages to be returned for asynchronous messages, use the PublicAPIAccess class for your adapter. You use PublicAPIAccess to generate an object that implements the interface AckFactory (package com.sap.engine.interfaces.messaging.api.ack).
The AckFactory provides methods for generating acknowledgment messages.
Methods of the Interface AckFactory
Name |
Use |
ackNotSupported |
The adapter must specify for each message which acknowledgment types it does not support. In the example adapter, these are the application acknowledgment types. This method must not be called until the end of message processing once it is certain that no further exceptions will arise because then the Adapter Framework sends error delivery acknowledgments automatically.
Open CCIInteraction.java and search for the character string CS_ACKNS. |
deliveryAck |
The delivery acknowledgment displays whether a message has been successfully delivered to the message layer in the last node (the end point) in the communication chain. In the example adapter, this is assumed to be the case once the file has been written to the file system with the message.
Open CCIInteraction.java and search for the character string CS_ACKDEL.
|
deliveryErrorAck |
If a message cannot be delivered to the end point and the adapter can recognize this status using the connected external protocol, it can send an asynchronous error delivery acknowledgment. If a Java exception is triggered during message processing, the Adapter Framework automatically sends an error delivery acknowledgment (if requested by XI) with an error text taken from the exception. In this case, the adapter must not call deliveryErrorAck() explicitly. Therefore, the error delivery acknowledgment is not set explicitly in the example adapter. |
applicationAck |
The application acknowledgment displays whether a message has been successfully processed by the application at the end point. Since the example adapter cannot recognize this, it does not support this type and declares this using the ackNotSupported method. |
applicationErrorAck |
The same as for application acknowledgment, but for the error case. |
To instantiate an AckFactory object, proceed in the same way as for MessageFactory. This is demonstrated in the example adapter in the XIMessageFactoryImpl class.

Open XIMessageFactoryImpl.java and search for the character string CS_MSGFCT.
An adapter can use the following API methods to recognize an acknowledgment:
● Message.isAck()
● Message.isAck(Ack Type ack Type)
● Message.isAckRequested()
● Message.is AckRequested(AckType ack Type)
For more information, see the JavaDoc.
In the adapter implementation, the message direction in the key of the acknowledgment message must be the same as the message direction in the message that the acknowledgment message refers to.
Follow the implementation template for the example adapter:
● Correct (the message is the XI message for which an acknowledgment is created):
MessageKey msgKey = msg.getMessageKey();
mf.deliveryAck(msgKey);
● Incorrect:
MessageKey msgKey = msg.getMessageKey();
MessageKey ackMsgKey = new MessageKey(msgKey.getMessageId(), MessageDirection.INBOUND);
Using the message direction is not limited only to creating acknowledgment messages. It can be used for all adapter framework APIs that have MessageDirection.