locked
Messages with references to objects RRS feed

  • Question

  •  

    Is it possible to send messages with object references between services and then use such a reference from the ?

     

    Basically what we might want to do is the following. Create a module (a service) that contains and manages the data, like a blackboard. Some of this data we want to make directly accessible to save time. Would it be possible to send a reference to a data object that another service can use (assuming it is running in the same process?).

     

    Someone mentioned it might be possible if you bypass generating proxies.

    Monday, November 26, 2007 11:21 PM

Answers

  • You can do it by declaring a static variable in your service implementation class. MSRS uses this trick for the simulation engine port.

    Tuesday, November 27, 2007 4:13 PM

All replies

  • You can do it by declaring a static variable in your service implementation class. MSRS uses this trick for the simulation engine port.

    Tuesday, November 27, 2007 4:13 PM
  • Thank you very much for the answer. That is one possibility.

     

    However, are there also other ways? Any suggestions are welcome.

     

    Tuesday, November 27, 2007 4:35 PM
  • As far as I know, there are other ways since you will never get a reference to another service implementation object instance in a service. Everything is hidden by the DSS layer.( Well, maybe you could try something like pin the object in memory, get a pointer to the object, and send the pointer's value in a message, but that would become really ugly)

    Another better way might be simply not doing this. I don't have enough info on your application to give an opinion, but maybe you could consider putting everything into one DSS service. If you suppose that everything would always happen in the same process, that could make sense.

    If you need service-like functionalities, you can still use CCR services, and combine them inside a big DSS service. This would avoid breaking the DSS layer "philosophy".

    Tuesday, November 27, 2007 4:53 PM