locked
MSRDS2008: New parameter in CreateInterleaveFromDsspOperationHandlers? RRS feed

  • Question

  • Hi there,

    I'm relatively new to MSRDS and don't have a great amount of knowledge when it comes to the CCR/DSS etc, but I've been able to make some really cool things happen in my Robotics project using MSRDS so far!  Very impressed with your work. :)

    I have, however, run into a problem.  I am now trying to create a DSS Test Service (by following the tutorial at http://msdn.microsoft.com/en-us/library/bb608246.aspx) for one of the services used in my project.  The only problem is that this tutorial doesn't seem to be updated for MSRDS2008 as the quoted CreateInterleaveFromDsspOperationHandlers method only takes three arguments.  In MSRDS2008, there's an extra argument required (of type List<Port<DateTime>>)!

    I can't seem to find anything about this extra argument on the web.  Could somebody kindly explain what needs to be done to satisfy this final argument?  I'm struggling to understand why it's needed... :(

    Many thanks in advance,

    Sam
    Wednesday, January 21, 2009 5:41 AM

Answers

  • Hi Phillip,

    Firstly, thanks so much for your help!  I've learned a lot from digging a bit deeper after your posts.

    The good news is that the tests are now running, and I'm getting the expected results.  I followed your recommendation in your last post, but I was having issues with the line:

    Activate(base.CreateInterleaveFromDsspOperationHandlers(this, _mainPort, "_mainPort"ref periodicHandlerEventPorts));  

    Now, it seems that the CreateInterleaveFromDsspOperationHandlers method actually does the activation, because if you remove the Activate, it works!

    I had a look at the method using a reflector, but wasn't really able to explain why this was.  Maybe a bit more digging will make it clear.  Anyway, it works, which is enough for now!

    Cheers,

    Sam
    • Marked as answer by Sam34 Friday, March 6, 2009 10:19 AM
    Friday, March 6, 2009 10:19 AM

All replies

  • The extra parameter is for storing ports created for service handler's that use the 'Interval' parameter in their ServiceHandler attribute.  You pass in an empty list to CreateInterleaveFromDsspOperationHandlers, when it discovers a service handler that uses 'Interval' it will create a TimeoutPort and add it to this list.  If none of your service handlers use 'Interval' then you can stop here as the list should still be empty on return.  However if you do there's a bit more work you need to do to, but exactly what that is I can't remember :)  You can use .NET Reflector to dig through the implementation of the DsspServiceBase.Start() method to find out exactly what needs to be done, IIRC there's another method (whose name I can't remember) which gets called with the list that does all the extra work, but it's private so you'd have to re-implement it (or maybe you can cheat and call it using reflection?).

    Phil.
    Thursday, January 29, 2009 12:48 AM
  • Actually, I went and double checked and it's not as bad as I thought.  The private method that I mentioned is actually called internally by CreateInterleaveFromDsspOperationHandlers(), all you need to do is post the first message to each timeout port added to the list, so you end up with something like this:

    protected override void StartTests()  
    {  
        List<Port<DateTime>> periodicHandlerEventPorts = null;  
        Activate(base.CreateInterleaveFromDsspOperationHandlers(this, _mainPort, "_mainPort"ref periodicHandlerEventPorts));  
        if (periodicHandlerEventPorts != null)  
        {  
            DateTime now = DateTime.Now;  
            foreach (Port<DateTime> port in periodicHandlerEventPorts)  
                port.Post(now);  
        }  
    Thursday, January 29, 2009 6:04 AM
  • Hi Phillip,

    Firstly, thanks so much for your help!  I've learned a lot from digging a bit deeper after your posts.

    The good news is that the tests are now running, and I'm getting the expected results.  I followed your recommendation in your last post, but I was having issues with the line:

    Activate(base.CreateInterleaveFromDsspOperationHandlers(this, _mainPort, "_mainPort"ref periodicHandlerEventPorts));  

    Now, it seems that the CreateInterleaveFromDsspOperationHandlers method actually does the activation, because if you remove the Activate, it works!

    I had a look at the method using a reflector, but wasn't really able to explain why this was.  Maybe a bit more digging will make it clear.  Anyway, it works, which is enough for now!

    Cheers,

    Sam
    • Marked as answer by Sam34 Friday, March 6, 2009 10:19 AM
    Friday, March 6, 2009 10:19 AM