Download presentation
Presentation is loading. Please wait.
1
CORBA Event Service Martin Senger senger@ebi.ac.uk
2
What are the goals... exchanging data between two and more objects exchanging data between objects that do not know about each other a special case: asynchronous execution of an operation
3
What data are being exchanged “Untyped” data –usual case –data are wrapped in Any’s –which means: data of any but known type Typed data –objects are not purely unknown to each other –CosEvent specification is a bit under-specified –my opinion: it’s a bit cheating
4
How to achieve the goals Event Channel Data consum er Data consum er Data consum er Data supplier Data supplier Data supplier Data supplier Data supplier
5
Event Channel it is just another object it does not know what data it transfers –no filtering depending on data contents it behaves democratically –no filtering depending on suppliers/consumers two main functions –it registers event suppliers and consumers, –and it carries data for or from them which may be done cleverly (like keeping messages for not-(yet)-present consumers)
6
How to carry the data: Push Model I am a supplier. I have a data to be sent around. I wish to decide when the data are sent. Just let me know whom to send it. I am a consumer. I need data to be able to do something with them. I wish to wait for data. I will not take any initiative, just call my method when you have data for me. Data Initiative Push Supplier Push Consumer
7
How to carry the data: Pull Model I am a supplier. I have a data to be sent around. I wish to wait for those interested in my data. I will not take any initiative, just call my method when you want data I am a consumer. I need data to be able to do something with them. I wish to decide when to go for data. Just let me know where I can ask for data. Data Initiative Pull Supplier Pull Consumer
8
Two roles of user objects Supplier vs. Consumer –who has data and who wants data –data always go from suppliers to consumers Active vs. Inactive participant –active guys ( “PullConsumer” and “PushSupplier” ) do not need many methods because they actively call methods of passive guys –passive guys ( “PushConsumer” and “PullSupplier” ) need to have methods that are called; they are designed as “callback” objects
9
But where is the Event Channel? I am a supplier. And I am pushing data I am a consumer. And I am pulling data InitiativeInitiative I am a supplier. And I am waiting to give data I am a consumer. And I am waiting for data InitiativeInitiative
10
So what is the Event Channel for? a mediator of antagonistic initiatives a multiplier of data events (one supplier for more consumers) …and vice-versa (more suppliers for one consumer) a provider of “quality of service” –storing messages, re-sending them, etc. –but this is not part of CosEvent Service interfaces
11
What you need to do create your suppliers and/or consumers –application specific task register them and register their behaviour –two steps registration to obtain a proxy supplier/consumer, and to connect to it to do it, however, you need an Event Channel –interface to a factory of Event Channels is not standardised
12
SupplierAdmin for_suppliers() ConsumerAdmin for_consumers() void destroy() EventChannel ProxyPushConsumer obtain_push_consumer() ProxyPullConsumer obtain_pull_consumer() SupplierAdmin I am a suppli er I am a consu mer PushSupplier void push(in any data) PushConsumer ProxyPushSupplier obtain_push_supplier() ProxyPullSupplier obtain_pull_supplier() ConsumerAdmin usually provided by a service written in your application void connect_push_supplier(in PushSupplier) ProxyPushConsumer active mode void connect_pull_supplier(in PullSupplier) ProxyPullConsumer passive mode disconnect methods are not shown any pull() any try_pull (out boolean has_event() PullSupplier connect_push_consumer(in PushConsumer) ProxyPushSupplier passive mode void connect_pull_consumer(in PullConsumer) ProxyPullSupplier active mode PullConsumer
13
A code example: PushSupplier // registration SupplierAdmin supplierAdmin = eventChannel.for_suppliers(); ProxyPushConsumer consumer = supplierAdmin.obtain_push_consumer(); consumer.connect_push_supplier (null); // sending data consumer.push (data); // diconnecting consumer.disconnect_push_consumer();
14
A code example: PushConsumer // my implementation of a PushConsumer (receiving data) public class PushConsumerImpl extends _PushConsumerImplBase { public void push (Any any) {…} public void disconnect_push_consumer() {…} } // registration & connecting my implementation as a visible object PushConsumerImpl consumer = new PushConsumerImpl(…); orb.connect (consumer); ConsumerAdmin consumerAdmin = eventChannel.for_consumers(); ProxyPushSupplier supplier = consumerAdmin.obtain_push_supplier(); consumer.connect_push_supplier (consumer); // waiting for incoming requests boa.impl_is_ready (null);
15
From-the-shelf implementations CosEvent Service as a standalone product EventChannelFactory usually provides “Default” EventChannel creates A non-standard interface (an example) interface EventChannelFactory { EventChannel create_channel (in string id) raises (ChannelAlreadyExists); EventChannel get_channel_by_id (in string id) raises (ChannelNotAvailable); …get_channels… …shutdown()... An application using COSEvent Service
16
There are other issues... Typed event communication –objects call operations on other objects using some mutually agreed interface Notification Service
17
Notes for hands-on go to directory EventService play with –java TalkToMe -help change class EventExchanger to use different push/pull model
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.