Z23 Problem ClassDate: 18/01/2005

Session 3: CORBA Event Service

The purpose of this class is to introduce you to the CORBA event service. You will adapt the existing Account service to push an event to a CORBA event channel whenever the balance of the account object changes.

Downloads:

We have provided a partial solution to get you started. Download the following codes from the course website:

or copy from a Unix shell:

cp /cs/research/sse/home1/rigel/ucacwxe/public_html/lectures/Z23-04-05/event03/* .

AccountClient.cc: This is exactly the same as the client in the static invocation example. You should not need to change the code.

account.idl: The interface definition for the account server. No change here either.

CreateChannel.cc: This program accesses the EventChannelFactory service which it uses to create a new event channel that is bound to name

AccountBalanceChannelin the root naming context of the naming service. Your modified Account server should push events to this channel whenever the balance changes. The demonstrators will run this at the beginning of the class so that the event channel is available for your new server. You should not need to execute this code yourself during the class.

Makefile: explains how the source code is built – use gmaketargetto build targets.

MakeVars: defines variable constants in Makefile

In addition, we have already implemented a listener service that registers itself to the AccountBalanceChannel and implements the void push(const CORBA::Any & data) operation to process an incoming event. The demonstrators will run this service to monitor balance-change events that each of your Account servers push on to the channel. We will release this code near the end of the session.

.micorc: download a new version of the .micorc (notice the dot prefix) that has correct configuration for the event service. Copy this file into your home directory:

web link:

Unix copy:

cp /cs/research/sse/home1/rigel/ucacwxe/public_html/lectures/Z23-04-05/.micorc ~

Instructions:

The following instructions explain what you have to do to modify the account server to push events to the AccountBalanceChannel.

  1. Obtain an object reference to the event channel from the naming service in the same way you did for the Z22 coursework and pass it to Account_impl.
  1. Modify the Account_impl class to push an event with the new balance as an unsigned long into the event channel whenever the balance changes.

Once you have achieved this, start the server and modify balances with the AccountClient (which is the static client from Lab Session 1). Confirm with a demonstrator that your events are received.

If you get through this task before the end of the lab session write a listener that subscribes to the event channeland processes incoming events by printing new balances onto stdout.