Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

Message Processing Procedure

To process queued messages, a processing thread takes the following steps:

  1. The thread sets ctx2 to have the value NULL:

    ctx2 = NULL;

    For information on the process_message arguments, see process_message() Routine

  2. 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.

  3. For the message file, the thread creates a dequeue context that maintains the dequeue processing state for that message file.

  4. 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

  5. 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.

  6. 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.

  7. The dequeue context is destroyed.

  8. If the process_message routine did not return the MTA_ABORT status code, then repeat this cycle starting at Message Processing Procedure.

  9. 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

  10. The thread exits.