SHUTDOWN Messages

Introduction

Support for !SHUTDOWN-… messages is coded into the base Application class. It should not be necessary for any application to explicitly implement handle these messages. Your application may wish to extend the shutdown_notice and shutdown_now methods in order to perform cleanup.

The internal !SHUTDOWN-… messages are:

Note that these messages begin with the special ! character, and so are treated as administration messages. They will be passed between applications using the dedicated administration message FIFO mechanism, and will always be processed before user-level messages are processed.

!SHUTDOWN-NOTICE

The !SHUTDOWN-NOTICE message is sent by the WatchdogApp to all other applications when the shutdown process is initially triggered. The application’s shutdown_notice method will be invoked and the application’s shutdown_level attribute will be set to SHUTDOWN_LEVEL_PENDING.

The application should extend the shutdown_notice method in order to stop accepting new sessions for processing. The application should consider beginning a termination process on existing sessions.

If the application has a cleanup task which requires interaction with other applications, or which may take some time to complete, the application should begin that cleanup task now.

The attributes of the !SHUTDOWN-NOTICE message are:

Field Type Description
seconds Integer The number of seconds until the !SHUTDOWN-NOW message will be sent.

!SHUTDOWN-NOW

The !SHUTDOWN-NOW message is sent by the WatchdogApp to all other applications a configured number of seconds after the shutdown process is triggered. The application’s shutdown_now method will be invoked and the application’s shutdown_level attribute will be set to SHUTDOWN_LEVEL_SHUTDOWN.

No more EDRs can be written after this time. User-level messages between applications are no longer permitted after this time.

The application should perform final internal cleanup tasks such as caching state to disk, flushing buffers, shutting down network sockets, closing files, etc.

The attributes of the !SHUTDOWN-NOW message are:

Field Type Description
milliseconds Integer The number of milliseconds until the application will be terminated.

After the configurable number of milliseconds has elapsed, the next application polling loop cycle will call exit to terminate the application process.