In order to allow a Domain Manager to send subscribed events to a client program, the client must first register itself with the Domain Manager as an event observer.

In Perl, this is done by using the observer() method of the InCharge::session module. Two steps are required:

  1. Connect to the Domain Manager and get a valid session object handle.

    First, the client must connect to the Domain Manager which establishe s a new InCharge::session connection. This is done by using either the InCharge::session->new() or InCharge::session->init() methods.

    Here are some example code fragments that achieve this goal:

      $session = InCharge::Session->init( )
      $session = InCharge::session->new(
       broker=>"192.168.0.3",
       domain=>"INCHARGE"
      );
    
  2. Attach an observer to the Domain Manager session.

    Once the script has obtained a handle that references the script/server connection ($session in step 1 on page 22), it can be used to obtain a second connection to the notification engine of the Domain Manager. This is obtained by using the observer() method on the InCharge::session handle just obtained. The following code performs this action.

      $observer = $session->observer();
      $observer->detach();