Multiple implementation of the same object
Lionel Dricot
zeploum at gmail.com
Tue Dec 2 07:31:24 PST 2008
Thanks for your explanation. It helps me a lot.
I've still one more question : what if Service3 want to compute the mean
between Service1 and Service2. It means that the Client will not care if it
uses Service 1,2 or 3 but that Service 3 itself want to specifically ask
Service1 and 2, even if they have lower priority ! (and of course, it
doesn't want to ask himself). Is it possible with the FLAG ?
Thanks a lot for your help.
Lionel
On Tue, Dec 2, 2008 at 3:34 PM, Kalle Vahlman <kalle.vahlman at gmail.com>wrote:
> 2008/12/2 Lionel Dricot <zeploum at gmail.com>:
> > Hello,
> >
> > I want to use D-Bus to allow one "client" to get some information from a
> > "service" object. But this service object could be implemented multiple
> > times. I want to be able to just launch a new implementation of "service"
> in
> > the pool without having to change the "client" implementation at all.
> Client
> > should automatically use the the service with the highest priority.
> [snip]
> > So, how would you do that ?
>
> When D-Bus services register bus names they can determine with flags
> how they react when someone else owns the name or tries to register
> the same name. Also you get signals (NameOwnerChanged and NameLost)
> from the Bus when such activity occurs.
>
> So in your example, the local service (high priority) should request
> the service name with the flag (names from the low-level lib)
> DBUS_NAME_FLAG_REPLACE_EXISTING so it replaces any other service using
> the name.
>
> The website service then requests the same bus name with
> DBUS_NAME_FLAG_ALLOW_REPLACEMENT so that the higher priority service
> can always snatch it when it comes around again.
>
> If you need more featureful priority handling than high/low, you'll
> need to implement some sort of negotiation between the service
> instances, but the client side still doesn't need to know about it.
>
> More details about requesting names:
>
>
> http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusBus.html#g4b4903adad0199119c9e49ad18e0cb25
>
> --
> Kalle Vahlman, zuh at iki.fi
> Powered by http://movial.fi
> Interesting stuff at http://sandbox.movial.com
> See also http://syslog.movial.fi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20081202/1fb76d62/attachment.htm
More information about the dbus
mailing list