Creating Acknowledgment Messages
If you want to send acknowledgment messages for asynchronous messages, use the Connection class for your adapter. This class provides methods for generating acknowledgment messages.
Methods of the Connection Class
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 object of the connection class, 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.

The Connection class provides other methods in addition to the acknowledgment methods. However, these must not be used by an Adapter-Framework-compliant adapter implementation.
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.
Adapter implementation opens a connection in the following form to process acknowledgments:
msConnectionFactory = (ConnectionFactory) initctx.lookup(ConnectionFactory.JNDI_NAME);
conn = msConnectionFactory.createConnection("AFW");
...
conn.ackNotSupported(messageKey, acksNotSupported);
You can change this connection as follows:
conn = msConnectionFactory.createConnection(adapterType + "_" + adapterNamespace);
If you do not change the connection, the thread pool of the Adapter Framework processes acknowledgments.

adapterType and adapterNamespace can change if, for example, they are defined as MCF properties.