-
1. Re: Service Metadata
kcbabo Jan 10, 2011 9:18 PM (in response to kcbabo)I updated the branch with a slight refactoring of how Exchange instances are created. Instead of passing a service QName and the exchange pattern, I changed the API to take a Service reference and an operation name. The exchange pattern can be derived from the operation details on the ServiceInterface. There is an option to omit the operation name in one of the createExchange() methods, which results in the use of ServiceInterface.DEFAULT_OPERATION underneath the covers. The idea is that this would be used by services that don't care about operation-level granularity - e.g. a service that accepts one type of message.
Old Way
ServiceDomain domain = ServiceDomains.getDomain(); QName serviceName = new QName("blah"); Exchange exchange = domain.createExchange(serviceName, ExchangePattern.IN_OUT, new MyHandler());
New Way
ServiceDomain domain = ServiceDomains.getDomain(); QName serviceName = new QName("blah"); Service service = domain.getService(serviceName); Exchange exchange = domain.createExchange(service, new MyHandler());
The real change here is that the creator of the exchange selects the registered service before creating the exchange. It removes the requirement to set the exchange pattern, since we already know this from the registered service's metadata. Tends to tighten things up a bit, I think. I briefly considered moving the createExchange() methods to the Service class, but that got funky with the internals and I wasn't sure it felt right. Might be worth revisiting. Thoughts?
-
2. Re: Service Metadata
tcunning Jan 13, 2011 10:16 AM (in response to kcbabo)Probably want a way of specifying the service-choosing policy that we talked about for AddressingHandler.java here too :
ServiceDomain domain = ServiceDomains.getDomain(); QName serviceName = new QName("blah"); ServicePolicy policy = new SimpleServicePolicy(); Service service = domain.getService(serviceName, policy); Exchange exchange = domain.createExchange(service, new MyHandler());
-
3. Re: Service Metadata
kcbabo Jan 13, 2011 3:00 PM (in response to tcunning)Agreed. In my mind, I was thinking that the client of the API would grab a list of all services (say for a particular interface) and then make the policy choice on its own. This way we don't have to mess with allowing extensions in AddressingHandler and we can do away with the service-choosing logic in there altogether. e.g.
List<Service> services = getServices(ServiceInterface serviceInterface); for (Service s : services) { if (matchesPolicy(s.getPolicy)) { // use this service break; } }