skuleguy

Hi,
This is my second post today, guys, on how a service could send and receive messages.
In the "Service Component" topic in the MSRS's User Guide, George and Henrik mentioned that:

There are two ways a service can send messages:

  1. Unsolicited in the form of a request message sent to another service.

  2. Solicited in the form of an event notification sent to a subscriber as a result of a state change within the service generating the event notification.

So I'm wondering what is the syntax for doing it the unsolicited way. Say, I'm inside one service, how can I post a message on another service

So far, I have seen "subscription" working well for sending notifications. But that's not helping me much because I would like to allow my service (for example, service A) to receive notification from the service B (subscribing to A) as well.

I'm sorry, this might be a simple thing, but I couldn't find a way to do it. Please help.
Thanks





Re: Microsoft Robotics - Decentralized Software Services (DSS) how to send a request message to another service in unsolicited way ?

George Chrysanthakopoulos

Within a service, trying to talk to another service, you do something like this, assuming you have some string or URI of the service you want to talk to ( you can get URIs from querying the directory, from your partner list, etc)

Code Snippet

webcam.WebCamOperationsPort webcamPort = ServiceForwarder<webcam.WebcamOperationsPort>(http://somemachinehost:50000/webcam);

// create request

webcamQueryFrame query = new webcam.QueryFrame();

// post request, you can also use friendly methods on the operations port itself

webcamPort.Post(queryFrame);

//process response

yield return Arbiter.Choice(queryFrame.ResponsePort,

delegate(webcam.QueryFrameResponse rsp) { // do something},

delegate(Fault f){ // deal with fault}

);

Note that if you use our Partner attribute, the DSS runtime will do the ServiceForwarder step on your behalf. Please review the advanced service tutorials, they have examples of this. Also alot of our "top level" service samples, that issue slots of requests to other services, like the Explorer service, do this all the time.

thanx

g





Re: Microsoft Robotics - Decentralized Software Services (DSS) how to send a request message to another service in unsolicited way ?

skuleguy

Thanks, George
I find your answer very helpful.