locked
Distributed Queries: How to implement query/response of subscribed services? RRS feed

  • Question

  • We need to implement a multi-node services model that includes 3 types of services: a Manager, a Supervisor, and a Worker.  Only 1 Manager instance exists among all nodes.  Each node has a single instance of Supervisor and multiple instances of Worker.  Workers can be started or dropped at any time and the Supervisor must adjust appropriately.  Each Worker instance is configured differently, and the Worker's query response is a function of the query input and the current state of the Worker. 

    We want to allow the Manager to accept a query message, forward the query to subscribed/registered Supervisors which in turn will forward the query to subscribed/registered Workers.  The Supervisor needs to wait for all of the notified workers to respond to the query, aggregate the Worker responses, and respond to the Manager.  The Manager needs to wait for all the Supervisors to respond, aggregate the Supervisor responses, and respond to the initial query request.

    Obviously we're not using this model to control a robot but rather for a business process that requires very high throughput.

    Has anyone attempted to build such a topology?  Can it be done using the Subscription model?  Wouldn't this be a good sample to add to the next release of MSRS? :)

     

    Wednesday, September 1, 2010 8:43 PM

Answers

  • I'm not sure the subscriber service is a good approach. It manages a list of subscriber (what you need), but the notifications are "one way" message (no response). In your topology, you need "two ways" messages to aggregate response.

    Maybe you could try to implement your own subscription system in the Manager and Supervisor with an Insert operation that have the subscriber service port URI as parameter. The handler just have to create a ServiceForwarder and each time a query is requested, it sends a message for each fowarder and waits for a response with a Arbiter.Join on the messages reponse ports.

    I guess there are mainy other ways (with subscription service or not), so it's just an example.

    In more pratical way, you could have some kind of circular depencies (Manager needs to know supervisor contract and supervisor needs to know manager contract), so you should define all your services desciptions in a generic assembly (without any implementation) that will be share by all implementations.

    Regards,

    Vincent


    http://www.simplysim.net/
    Friday, September 3, 2010 6:32 AM