Skip to main content

Life Cycle of a Business Operation and Adapter

Life Cycle of a Business Operation and Adapter

InterSystems IRIS automatically manages the life cycle of each business operation.

Production Startup

When you start a production (or change the configuration of a specific business operation), InterSystems IRIS automatically performs the following tasks for each configured business operation class (that is, for every business operation listed in the production definition):

  1. It invokes the class’ OnProductionStart() callback method, if defined.

    The OnProductionStart() method is a class method that is invoked once for each business operation class listed in the production configuration. A business operation class can use this callback to perform any class-wide initialization it may require.

  2. It creates one or more background processes in which to execute the business operation.

    The number of background processes is determined by the business operation’s PoolSize property within the production configuration. Each background process is referred to as an instance of the business operation and contains an instance of a business operation object.

    InterSystems IRIS will only create a background process for a business operation if the following conditions are true:

    • The business operation class must set its INVOCATION class parameter to Queue.

    • The business operation’s Enabled property within the production configuration must be set to 1 (otherwise the business operation is considered to be disabled). A disabled business operation still has an incoming message queue. Any requests posted to this queue will not be processed until the business operation is enabled.

    • The business operation’s PoolSize property within the production configuration must be set to a value greater than 0.

    If the business operation’s Foreground property within the production configuration is set to 1, then InterSystems IRIS will create a foreground process (that is, it will create a Terminal window) for the business operation. This feature facilitates testing and debugging.

  3. It initializes the system monitoring information used to monitor the status and operating history of the business operation.

  4. Within each background process:

    1. InterSystems IRIS creates an instance of the business operation class, supplies the most recently configured values of any of the business operation’s settings, and invokes the business operation OnInit() callback method (if present). The OnInit() method is an instance method that provides a convenient place to execute any initialization logic for a business operation.

    2. InterSystems IRIS creates an instance of the associated adapter class (if one is defined) and supplies the most recently configured values of any of the adapter’s settings.

Runtime

At runtime, a business operation does the following:

  1. It waits for requests to be sent (from business services, business processes, and other business operations) to its associated message queue.

  2. After the business operation retrieves a request from its message queue, it searches its message map for the operation method that corresponds to the request type. It then invokes that operation method.

  3. The operation method, using the data within the request object, makes a request to an external application. Typically it does this by calling one or methods of its associated outbound adapter object.

Production Shutdown

When a production stops, the following events related to business operations occur:

  1. InterSystems IRIS waits for each business operation to reach a quiescent state (that is, InterSystems IRIS waits until each business operation has completed all of its synchronous requests).

  2. The OnTearDown() method in each outbound adapter is called.

  3. All outbound adapter and business operation objects are destroyed and their background processes are killed.

  4. Each business operation’s OnProductionStop() class method is called, once for each configured item of that class in the production.

When a business operation is disabled by a system administrator, or becomes inactive according to its configured schedule, the production continues to run but the associated outbound adapter is shut down, and its OnTearDown() method is executed.

FeedbackOpens in a new tab