Using multiple Interfaces for services
HI.
Love robotlegs! K. I am trying to use multiple services with
interfaces for my application, for instance, I have an AMF remoting
service and a JSON service. Say for instance, whichever service I
need is a property in a proxy. What's the cleanest way to map my
service "on demand" so I can use multiple services if
necessary?
Can you provide a simple example please.
Thanks,
Patrick
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Stray on 19 Jun, 2011 07:30 PM
Hi Patrick,
just checking - do you mean you want to switch the JSON / AMF / whatever service at runtime?
Stray
3 Posted by patricklemiuex on 19 Jun, 2011 07:40 PM
Stray,
Yes that's correct at runtime, depending which option is selected - i
have advanced settings.
4 Posted by ZackPierce on 23 Jun, 2011 05:19 AM
Because re-injection into objects isn't currently supported in Robotlegs/SwiftSuspenders 1.X, it's less than straightforward to attempt to solve this by injection-mapping-switching on the fly, especially if any persistent (read non-Command) objects have lingering references to your service interface (I'm looking meaningfully in the direction of the mediators).
So, one solution is to use a strategy pattern. Make an implementation of your service interface that delegates all of the real work to an
implementationproperty. Then, use commands to swap your different AMF / JSON variant objects into that property on demand.Ondina D.F. closed this discussion on 02 Nov, 2011 05:22 PM.