The obtain_push_supplier method should be invoked if the calling consumer application is implemented using the push model. If the application is implemented using the pull model, the
obtain_pull_supplier method should be invoked.
The returned reference is used to invoke either the connect_push_consumer, described in , or the
connect_pull_consumer method, described in
“ProxyPullConsumer”.
The EventChannel provides the administrative operations for adding suppliers and consumers to the channel and for destroying the channel. For information on creating an event channel, see
“EventChannelFactory”.
Suppliers and consumers both use the _bind method to obtain an
EventChannel reference. As with any
_bind invocation, the caller can optionally specify the object name of the desired
EventChannel as well as any desired bind options. These arguments can be passed to the supplier or consumer as initial parameters or they may be obtained from the Naming Service, if it is available. If the object name is not specified, VisiBroker Edition locates a suitable
EventChannel. Once a supplier or consumer is connected to an
EventChannel, it may invoke any of the
EventChannel methods.
int main(int argc, char* const* argv)
{
...
CosEventChannelAdmin::EventChannel_var my_channel =
CosEventChannelAdmin::EventChannel::_bind("power");
CosEventChannelAdmin::SupplierAdmin_var =
channel->for_suppliers();
...
}
This method returns a ConsumerAdmin object that can be used to add consumers to this
EventChannel.
This method returns a SupplierAdmin object that can be used to add suppliers to this
EventChannel.
The EventChannelFactory provides methods for creating, locating, and destroying event channels.
module CosEventChannelAdmin {
interface EventChannelFactory {
exception AlreadyExists();
exception ChannelsExist();
EventChannel
create();
EventChannel
create_by_name(in string name)
raises(AlreadyExists);
EventChannel
lookup_by_name(in string name);
void
destroy()
raises(ChannelsExist);
};
};
EventChannel create_by_name(in string name) raises(AlreadyExists);
This method attempts to return the EventChannel with the specified name. If no channel with the specified name exists, a
NULL value is returned.
This interface is used by a pull supplier application and provides the connect_pull_supplier method for connecting the supplier's
PullSupplier-derived object to the
EventChannel. An
AlreadyConnected exception is raised if an attempt is made to connect the same proxy more than once. It can also raise the
TypeError exception if the proxy objects of an event channel implementation impose additional type constraints that are connected to them.
This interface is used by a push supplier application and provides the connect_push_supplier method which is used to connect the supplier's
PushSupplier-derived object to the
EventChannel. An
AlreadyConnected exception is raised if an attempt is made to connect the same
proxy more than once.
This interface is used by a pull consumer application and provides the connect_pull_consumer method which is used for connecting the consumer's
PullConsumer-derived object to the
EventChannel. An
AlreadyConnected exception is raised if an attempt is made to connect the same
PullConsumer more than once.
This interface is used by a push consumer application and provides the connect_push_consumer method which is used to connect the consumer's
PushConsumer-derived object to the
EventChannel. An
AlreadyConnected exception is raised if an attempt is made to connect the same
PushConsumer more than once. It can also raise the
TypeError exception if the proxy objects of an event channel implementation impose additional type constraints that are connected to them.
This interface is used to derive consumer objects that use the pull model of communication. The pull method is called by a consumer whenever it wants data from the supplier. A
Disconnected exception is raised if the supplier has disconnected.
The disconnect_pull_consumer method is used to deactivate this consumer if the channel is destroyed.
This interface is used to derive consumer objects that use the push model of communication. The push method is used by a supplier whenever it has data for the consumer. A
Disconnected exception is raised if the consumer has disconnected.
module CosEventComm {
interface PullSupplier {
any
pull() raises(Disconnected);
any
try_pull(out boolean has_event) raises(Disconnected);
void
disconnect_pull_supplier();
};
};
any try_pull(out boolean has_event);
This non-blocking method attempts to retrieve data from the supplier. When this method returns, has_event is set to the value
true and the data is returned as an
Any type if there was data available. If the value of
has_event is
false, then no data is available and the return value is
NULL.
void disconnect_pull_supplier();
This interface is used to derive supplier objects that use the push model of communication. The disconnect_push_supplier method is used by the
EventChannel to disconnect supplier when it is destroyed.
The obtain_push_consumer method should be invoked if the supplier application is implemented using the push model. If the application is implemented using the pull model, the
obtain_pull_consumer method should be invoked.