Hello,<br><br>I want to use D-Bus to allow one &quot;client&quot; to get some information from a &quot;service&quot; object. But this service object could be implemented multiple times. I want to be able to just launch a new implementation of &quot;service&quot; in the pool without having to change the &quot;client&quot; implementation at all. Client should automatically use the the service with the highest priority.<br>
<br>One example will maybe be better to explain it :<br><br>Let say that I want to have the local temperature. <br><br>Service 1 read the temperature from a real thermometer outside of the building.<br>Service 2 read the temperature from a meteorological website<br>
<br>I want program Service 1 to have a priority of 100. Service 2 is less precize so it has a priorityy of 10.<br><br>client want to know the temperature :<br><br><br>Usecase 1 : both services are running<br>Client should automatically get the temperature from Service 1<br>
<br>Usecase 2 : Service 1 is down<br>Client will still retrieve the temperature and, without knowing it, will retrieve it from Service 2.<br><br>Usercase 3: A new super thermometer is implemented as Service 3 with priority 2000 (with service 1 and 2 still running)<br>
This service 3 will just have to be launched and register itself to the same session bus. Without any modification in Service1, 2 or client, client will automatically use Service 3 if available.<br><br>Bonus Usecas 4: Service 1 adjust its priority automatically and decrease it if values are abnormal or if the hardware is down<br>
Client still use the highest priority so it fall back transparentely to service 2.<br><br><br><br>Usecase 1,2 and 3 are mandatory for me. Usecase 4 is only an optionnal bonus so it&#39;s really not important.<br><br>Is there a way to implement my usecase 1,2 and 3 with D-Bus with a few complexity as possible on the client side ?<br>
<br><br>Currently, the only way I see is to have each service register on a bus &quot;Service.Temperature.$SERVICE_NBR&quot; and to export the same object with the same interface<br>On the client side, you could do :<br>&nbsp;&nbsp;&nbsp; liste = bus.list_names()<br>
&nbsp;&nbsp;&nbsp; for i in liste :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if i.startswith(&quot;Service.Temperature&quot;) :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get_priority(i)<br>&nbsp;&nbsp;&nbsp; use i with highest priority.<br><br><br>But it seems an highly ineffective method which a lot of complexity for the client.<br>
<br>So, how would you do that ?<br><br>Thanks in advance for all the ideas,<br><br>Lionel<br>