Hi Rickard, I like your proposal – see my notes below.
> I'd like to discuss the proposed change of "active service" to "available > service". The basic reason is that as a client I don't really care if the > service is active or not at a particular time. I do care whether it's > available or not though, and so it would be good to be able to ask the API > about whether a particular service is available. I made the same experience in one of my last projects where I had to work with an external system that became unavailable when a synchronization process has started. Since I had no control over this system I need to know if the service was available and not if it was active. So for cases where you talk to external systems (via imported services) it would help to make your client code more meaningful and it better expresses what's going on. > In the API, isActive() in ServiceReference would be changed to isAvailable() > so that this could be queried for. This only causes a small change to the API but leads to more meaningful code. > The default would be that all native Qi4j services are available. For imported > services the current isActive method would be renamed to isAvailable, and > it can implement it any way it wants to. I'm just joking, but there is truth behind it: Think of an 'exported service' (a fictional third category of a service) and a scenario where we would like to implement a policy (e.g. expose this service from 10 to 11am) to manage the availability for external consumers. In this example we would also need a way to mark the exported service as unavailable as soon as we leave the above defined time interval. And we would have another case where we can implement isAvailable in several ways depending on our business needs. To put it in one line: We start to computed isAvailable in addition to only query for it. > For services that want to support it, what I usually do is to have a > property "enabled" in the ConfigurationComposite of the service that I want > to enable/disable. Usually these services communicate with an external > service, and so if I know that it's not available (e.g. a mail server, web > service, or database), I will set it to "disabled" in the configuration. The > configuration of the connection might be there (e.g. database URL, > username/password, etc.), it's just that at the moment I don't want the > application to even try making a connection. Yes, if a client knows that a service is not available it should really don't start to connect to it and avoid putting load on the system in this way. Cheers, Maik _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

