To process queued messages, a processing thread takes the following steps:
The thread sets ctx2 to have the value NULL:
ctx2 = NULL;
For information on the process_message arguments, see process_message() Routine
The thread communicates with the Job Controller to obtain a message file to process. If there are no more message files to process, then go to Message Processing Procedure.
For the message file, the thread creates a dequeue context that maintains the dequeue processing state for that message file.
The thread then invokes the caller-supplied process_message routine, passing to it the dequeue context created in Message Processing Procedure, for example:
istat = process_message(&ctx2, ctx1, &dq_ctx, env_from, env_from_len);
For a description of the process_message routine, see process_message() Routine
The process_message routine then attempts to process the message, ultimately removing it from the channel’s queues or leaving the message file for a later processing attempt.
If mtaDequeueMessageFinish() was not called before the process_message routine returned, then the queued message is deferred. That is, its underlying message file is left in the channel’s queue and a later processing attempt is scheduled.
The dequeue context is destroyed.
If the process_message routine did not return the MTA_ABORT status code, then repeat this cycle starting at Message Processing Procedure.
The caller-supplied process_done routine is called, for example:
process_done(&ctx2, ctx1);
For a description of the process_done routine, see process_done() Routine
The thread exits.