I’m looking for implementing some sort of mediator (dispatcher/controller) between client app and server.
Client sends a command to mediator -> mediator processes (executes) the command. I use WCF as a platform for communication. Is there a way (pattern or smth) how I can add new commands to the client w/o changing the interface of the mediator?
Say mediator addresses several other services which are hidden from the client. Client sends command to server to perform some action. These action involves various domain services and server side classes.
Say later I decided to add a new command to the client. That new operation can be performed by domain services, but how can I trigger that action on remote machine, on domain services w/o having to extend mediator’s interface (because mediator is the only communication point between clients and server).
So generally, I’m looking for some kind of alternative to Controller in MVC pattern used in WEB apps, for not WEB app.
Any ideas? Solutions?
So it seems to me you need some sort of transparent proxy that is not aware of the message format and just passes is to appropriate back-end system. So, in other words you need something like “Message API” rather than “RPC API”. This can be accomplished in different ways – you can pass your message as XML, where you can indicated type of the command, name of the command, parameters, etc. Your mediator then based on type of the command can pass the command to appropriate backed system. That way if you add new command (name), only the backend system will need to be modified. Your mediator will have to be modified if you add new command type, but not just new command.
You can google Message API pattern for more information, for example:
http://www.servicedesignpatterns.com/WebServiceAPIStyles/MessageAPI