Once created, an event channel is available for use. Depending on the role of the process using an event channel, the preparation and processing steps vary. This section summarizes the required preparation steps prior to sending or receiving events and the event processing activity.
The push consumer implements the PushConsumer interface so it can receive method invocations from the event channel. The PushConsumer interface is specified in the file CosEventComm.idl. A class derived from PushConsumer provides implementations of the push( ) and disconnect_push_consumer( ) methods. The push consumer process implements a servant that hosts the PushConsumer object.
At runtime, the following activities take place:
for_consumers( ) operation on it. This operation returns a ConsumerAdmin object.
obtain_push_supplier( ) operation on the ConsumerAdmin object. This operation returns a ProxyPushSupplier object.
ProxyPushSupplier object, invoke the connect_push_consumer( ) operation. This operation takes a PushConsumer object as an argument, which is the PushConsumer interface you created previously.
push( ). The event channel invokes this method when a new event is
available.
disconnect_push_consumer( ). The event channel invokes this method if it
needs to disconnect. The process can take the necessary actions to effect an orderly shutdown.
The pull consumer can implement the PullConsumer interface, or it can act as only an event channel client. If it implements the PullConsumer interface it can receive the disconnect_pull_consumer( ) method invocation. The PullConsumer interface is specified in the file CosEventComm.idl. A class derived from PullConsumer provides an implementation of the disconnect_pull_consumer( ) method. The pull consumer process implements a servant that hosts the PullConsumer object.
If the pull consumer acts as only a client, it will not be able to receive disconnect_pull_consumer( ) requests from the event channel. However, it can pull events from the event channel.
At runtime, the following activities take place:
for_consumers( ) operation on it. This operation returns a ConsumerAdmin object.
obtain_pull_supplier( ) operation on the ConsumerAdmin object. This operation returns a ProxyPullSupplier object.
ProxyPullSupplier object, invoke the connect_pull_consumer( ) operation. This operation takes a PullConsumer object as an argument. If you want to be notified when the event channel needs to disconnect your pull consumer, you must provide a PullConsumer interface as described later. If you do not want to be notified, pass NULL as the argument to connect_pull_consumer( ) method.
pull( ) method on the ProxyPullSupplier when a new event is required. The pull( )method returns only a when a new event is available.
try_pull( ) method on the ProxyPullSupplier when you want to get an event or determine that one is not yet available. The try_pull( ) method returns with an indication of whether or not an event is available. If an event is available, try_pull( ) returns the event as well.
PullConsumer interface has been implemented, the event channel may invoke the disconnect_pull_consumer( ) method. When this method is invoked, it indicates that the pull consumer can no longer issue pull or try_pull( ) requests.
The push supplier can implement the PushSupplier interface, or it can act as only an event channel client. If it implements the PushSupplier interface, it can receive the disconnect_push_supplier( ) method invocation. The PushSupplier interface is specified in the file CosEventComm.idl. A class derived from PushSupplier provides an implementation of the disconnect_pull_consumer( ) method. The push supplier process implements a servant that hosts the PushSupplier object.
If the push supplier acts only as a client, it will not be able to receive disconnect_push_supplier( ) requests from the event channel. However it can push events to the event channel.
At runtime the following activities take place:
for_suppliers( ) operation on it. This operation returns a
SupplierAdmin object.
obtain_push_consumer( )
operation on the SupplierAdmin object. This operation returns a ProxyPushConsumer object.
ProxyPushConsumer object, invoke the connect_push_supplier( ) operation. This operation takes a PushSupplier object as an argument. If you want to be notified when the event channel needs to disconnect your supplier you must provide a PushSupplier interface as described later. If you do not want to be notified, pass NULL as the argument to connect_push_supplier( ).
ProxyPushConsumer.
PushConsumer interface has been implemented, the event channel may invoke the disconnect_push_supplier( ) method. When this method is invoked it indicates that the push supplier can no longer push events to the event channel.
The pull supplier implements the PullSupplier interface so it can receive method invocations from the event channel. The PullSupplier interface is specified in the file CosEventComm.idl. A class derived from PullSupplier provides implementations of the pull( ), try_pull( ) and disconnect_pull_supplier( ) methods. The pull supplier process implements a servant that hosts the PullSupplier object.
At runtime, the following activities take place:
for_suppliers( ) operation on it. This operation returns a SupplierAdmin object.
obtain_pull_consumer( ) operation on the SupplierAdmin object. This operation returns a ProxyPullConsumer object.
ProxyPullConsumer object, invoke the connect_pull_supplier( ) operation. This operation takes a PullSupplier object as an argument, which is the PullSupplier interface you created previously.
pull( ) The event channel invokes this method when an event is needed. You need to construct an event in a any variable. The event is returned as the value of the pull( ) method. When a try_pull( ) request arrives, the try_pull( ) method should either supply an event or indicate that no event is available.
try_pull( ) The event channel invokes this method when it wants to
determine if an event is available. If an event is available, it is returned as the value of the try_pull( ) method and the has_event variable is set to true. If no event is available, the has_event variable is set to false and a void any value is returned from the try_pull( ) method.
disconnect_pull_supplier( ) The event channel invokes this method to indicate that the pull supplier will no longer receive pull or try_pull( ) requests.