We need to design a flow service which calls an adapter service. However the adapter service should be able to pick which adapter connection to use based on input. i.e. adapter service should be able to dynamically change the connection to use whenever it is invoked? Also need to know what happens when multiple instances of this adapter service are invoked for concurrent invocations ?
I don�t know if this possible with 6.1, but I think I have read something about this for the new 6.5 Version.
I don’t know of any built-in way to do this. While there is a service to change an adapter services connection (pub.art.service:setAdapterServiceNodeConnection) it isn’t intended to be called during run-time, more as a way of switching adapter services to a new connection as a once-off.
Why don’t you just create a number of different adapter services (eg. insertData_sydney, insertData_london, insertData_newyork) and pick the right service dependant on your data? If you wanted to get slightly fancy (and not just use a branch) you could name your adapter services based on the data involved, and just pass the “sydney” bit into a service like PSUtilities.misc:invoke (in the PSUtilities package, available here on Advantage). Good luck.
pub.art.service:setAdapterServiceNodeConnection is the service that you use to change an adapter connection on an adapter service.
I opened this service request a few months ago.
You have to have two adapters with identical adapter services. And change the adapter service you call depending on the connection you want to use.
I created a service that will change all the adapter connections for all the services in a package. I use an XML file to hold all of the adapter service names and loop through the services changing the adapter connection.
Does your approach work at runtime, where 2 instances of a flow may call the same adapter service and using different adapter connection?
Eric, Unfortunately this solution does not work at runtime where 2 instances of a flow may call the same adapter service and use a different adapter connection.
You have two copies of the same service, each service uses a different connection. The pub.art.service:setAdapterServiceNodeConnection service enables you to copy an adapter service and change the adapter connection. Therefore, you don’t have to manually recreate the adapter services, you can copy them and change the adapter service. It’s not the greatest solution, but it’s the best one available in 6.1.
Are you performing same process in all database connections (something like multiple instances of ERP being connected, all with similar structure?) based on some input?
You could try one of this approach:
Use a TN to perform Routing to different flow services which talk to different apps
Build dynamic IFC path and use wm.b2b.edi.util:invoke from WmEDI, it will allow you to invoke services by passing path/name of the service to it (note: it is complex to debug).
Build a decision tree with branches, and invoke different flow services.