Thanks for your explanation. It helps me a lot.<br><br>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 ?<br>
<br>Thanks a lot for your help.<br><br>Lionel<br><br><div class="gmail_quote">On Tue, Dec 2, 2008 at 3:34 PM, Kalle Vahlman <span dir="ltr"><<a href="mailto:kalle.vahlman@gmail.com">kalle.vahlman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2008/12/2 Lionel Dricot <<a href="mailto:zeploum@gmail.com">zeploum@gmail.com</a>>:<br>
<div class="Ih2E3d">> Hello,<br>
><br>
> I want to use D-Bus to allow one "client" to get some information from a<br>
> "service" object. But this service object could be implemented multiple<br>
> times. I want to be able to just launch a new implementation of "service" in<br>
> the pool without having to change the "client" implementation at all. Client<br>
> should automatically use the the service with the highest priority.<br>
</div>[snip]<br>
<div class="Ih2E3d">> So, how would you do that ?<br>
<br>
</div>When D-Bus services register bus names they can determine with flags<br>
how they react when someone else owns the name or tries to register<br>
the same name. Also you get signals (NameOwnerChanged and NameLost)<br>
from the Bus when such activity occurs.<br>
<br>
So in your example, the local service (high priority) should request<br>
the service name with the flag (names from the low-level lib)<br>
DBUS_NAME_FLAG_REPLACE_EXISTING so it replaces any other service using<br>
the name.<br>
<br>
The website service then requests the same bus name with<br>
DBUS_NAME_FLAG_ALLOW_REPLACEMENT so that the higher priority service<br>
can always snatch it when it comes around again.<br>
<br>
If you need more featureful priority handling than high/low, you'll<br>
need to implement some sort of negotiation between the service<br>
instances, but the client side still doesn't need to know about it.<br>
<br>
More details about requesting names:<br>
<br>
<a href="http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusBus.html#g4b4903adad0199119c9e49ad18e0cb25" target="_blank">http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusBus.html#g4b4903adad0199119c9e49ad18e0cb25</a><br>
<font color="#888888"><br>
--<br>
Kalle Vahlman, <a href="mailto:zuh@iki.fi">zuh@iki.fi</a><br>
Powered by <a href="http://movial.fi" target="_blank">http://movial.fi</a><br>
Interesting stuff at <a href="http://sandbox.movial.com" target="_blank">http://sandbox.movial.com</a><br>
See also <a href="http://syslog.movial.fi" target="_blank">http://syslog.movial.fi</a><br>
</font></blockquote></div><br>