Basically - to get asynchronous event feedback from a service, you'll
probably need to use one of the established design models:
* create a listener interface on your service where bundles can
register to be notified of incoming message events. This is a
fairly generic Java model, not an OSGi specific one, and it's
workable but you do need to be careful around services stopping /
restarting in terms of what happens to listener lists.
* use a "whiteboard" model for services. I've never much used this
myself, but there are quite a few papers and examples on the web
if you google for "whiteboard". One of your whiteboard hooks can
be incoming message event notification
* user a service binder or iPojo style model (which can be used with
either of the above) to wire up events from potential message
sources to interested message destinations
There are probably many other variations and alternatives along these lines.
Regards
-- Rob
Kurvers, Eelco wrote:
Hi all.
Currently I'm writing my first "real" application using the OSGi
framework as a basis. Now I've got a problem with/ question about the
connection between a service and its client. I haven't dealt with this
problem in the OSGi environment before.
I've got a "control" unit, controlling a GUI and managing the entire
application. I also have got a service delivering the needed
connectivity to the network (used for sending simple TCP/IP messages).
Now the control registers the "messaging service". It can send a
message, which works perfect. However the Messaging Service can also
receive messages. The problem is the service doesn't now the control,
does it? How do I trigger the control to act upon an incoming message?
Should I throw an event or something or is there an easier way? The
control unit is not a service itself, so it can not be registered by the
service.
Anybody's got a suggestion to solving this problem? Thanks in advance.
Regards,
Eelco Kurvers
Trainee
_________________________________________
LogicaCMG - Releasing your potential
Kralingseweg 241-249
3062 CE Rotterdam
Netherlands
T: +31 (0) 10 253 7339
E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
www.logicacmg.com
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.
--
Ascert - Taking systems to the Edge
[EMAIL PROTECTED]
+44 (0)20 7488 3470
www.ascert.com