Adapter concept to fully support service versioning
goc Feb 25, 2013 6:31 AMHello,
I would like to discuss a new feature, I developed for SwitchYard [1].
My changes solve a similar issue as discussed in [2].
Essentially, my changes treat the problem of service versioning - for promoted component services.
An example [3] demonstrates the solution.
A component (OrderingServiceBean) provides certain functionality. This component is promoted twice, OrderingService and OrderingService2.
The real problem is, that the two service contracts differ, they are mutually incompatible for varios reasons.
For example the parameter datatype changed - can be solved using the SwitchYard's transformer ability.
A new method was added to the service interface ... this doesn't harm old service consumers.
But in some cases you wish to rename a method or have the ability to use another service for a certain operation - this issue is solved by my extension.
In the example, a method in service OrderingService2 was renamed. The component bean implements this service interface (Java interface).
Hence, consumers using the OrderingService will run into trouble accessing the new service.
My extension to SwitchYard is quite similar to the transformer concept. In switchyard.xml the following modification are required:
<adapters> <adapt.java xmlns="urn:switchyard-config:adapter:1.0" from="{urn:com.objectbay:switchyard.adapter.example:0.0.1-SNAPSHOT}OrderingService" to="{urn:com.objectbay:switchyard.adapter.example:0.0.1-SNAPSHOT}OrderingService2" class="com.objectbay.switchyard.adapter.example.adapters.OrderingServiceToOrderingService2Adapter" /> </adapters>
The attributes "from" and "to" are the two services, promoted by the component's bean.
"OrderingServiceToOrderingService2Adapter" is the java class, where the user can choose the new service operation:
public ServiceOperation lookup(String consumerOperation, ServiceInterface targetInterface) { if ("order".equals(consumerOperation)) { return targetInterface.getOperation("orderIt"); } return targetInterface.getOperation(consumerOperation); }
Well, what do you think? Could this be a feature for SwitchYard?
Let's discuss further here!
Christoph Gostner
[1] https://github.com/TrueMoe/core