The e-ADK is designed to handle exceptions using the throw/catch paradigm. Errors must be reported by throwing an exception. The preferred way to handle errors inside the e-ADK code is to use one of the throw macros:
NNADK_THROW_CRITICAL ("text")
NNADK_THROW_WARNING ("text")
NNADK_THROW_RETRY ("text")
A critical error usually relates to the target system; for example, the SAP or Siebel server is down, the database is down, or some other problem that would cause all subsequent messages to also fail.
Non-critical errors usually relate to data in the specific message containing an error such as a required field missing. With non-critical errors, the next message is likely to succeed.
The throw macros take a C-string, or character array, write the string to the log file, and either shut down the adapter or continue processing. To use these macros, NNADKMacro.h and NNADKLogging.h must be included. In any mode, the user can ignore the current message and continue processing by returning TRUE to the Adapter Shell. This runs the risk of lost data: the throw macros guarantee that the message gets placed on the failure transport. If the message cannot be delivered, the result of ignoring the message is that the data is neither sent to the target system nor sent to a transport. In that case, the data is lost.
Under certain conditions, an adapter may throw a critical exception that contains a value in the InformationCode1 field. This indicates a non-fatal error and, because of the value, the e-ADK keeps processing. The number of retries you have set is used.
Critical problems are handled using the NNADK_THROW_CRITICAL macro. NNADK_THROW_CRITICAL takes a character string, logs the string to the standard logfile, and then shuts down the shell. If a failure transport is defined for Deliver or Process mode, the message retrieved from the transport is placed on the failure transport before shutting down.
NNADK_THROW_WARNING takes a character string, logs the string to the standard logfile, and then continues processing. If a failure transport is defined for Deliver or Process mode, the message retrieved from the transport is placed on the failure transport before continuing.
NNADK_THROW_RETRY takes a character string, logs the string to the standard logfile, and then returns to the Adapter Shell. If adapter_wait_time and maximum.adapter.retries are set in the cfg file, the Adapter Shell retries calling the adapter function for a maximum number of times specified by maximum.adapter.retries waiting the number of seconds specified by adapter_wait_time before each retry. If those keys are not set, the Adapter Shell terminates.