I've come up with a basic client API for service discovery and utilization. Basically
the idea is you create a ServiceLocator (which identifies what service you want to talk
to), and you apply that to a Session (if you want to talk to a specific Endpoint) or to
your local Endpoint (if you want your local Endpoint to decide what other Endpoint(s) you
want to talk to).
Either way you get back a ContextSource instance, which can be used to mass-produce
Contexts that communicate with that service. Since the acquisition of Contexts is
abstracted behind this simple interface, an implementation may choose to rotate between
multiple remote Endpoints when acquiring Context instances, or apply a load-balancing
policy, etc.
In order to facilitate the various use cases for this, the ServiceLocator class has a
series of properties that can be set to allow a ServiceLocator to match one or more
candidates for a load-balancing arrangement.
The properties are as follows:
* serviceType - the actual kind of service you're looking for. All service instances
with a given serviceType would have consistent request and reply object types, so that a
piece of code that talks to that service type can be reused to talk to any other
implementation of that same type.
* serviceGroupName - the name of the group providing this service. A service might be
available as two distinct groups - for example, a production group and a testing group. A
"*" would mean match any service group.
* serviceGroupMemberName - the name of the individual member within a group. A service
might be deployed in more than once place for a group; this would allow you to select a
specific node or member of the group. A "*" (which would be the default value)
would mean match any service group member.
This arrangement allows us to do a few things:
* Deploy multiple instances of a service of the same type into a single Endpoint - an
example application would be a system with multiple test environments.
* Correlate services running on multiple Endpoints - for example, a cluster or
load-balancing situation where there are two nodes that access a common database.
Please give me your thoughts and comments.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108656#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...