locked
Creating Multiple instances of a service RRS feed

  • Question

  • I am making a complex VPL diagram containing multiple robots. These robots are controlled by our own implementation of a controller for them in C# and wrapped within a DSS service. The service contains stuff like movement, in and output handling and some more funcitonality.

    When creating a second robot within my VPL diagram and i try to do stuff on the one robot, it does the same on the other robot, which made me think there was some kind of issue with instancing of services within DSS. What i understand is that i need to do something to the service to make sure it actually creates a new instance of the service instead of using the running one.

    What i have at the moment is the following:

    [Description("Service for controlling Robots.")]
    [Contract(Contract.Identifier)]
      public class Controller : DsspServiceBase, IDisposable
    {
    [ServiceState]
    [InitialStatePartner(Optional=false)]
    private State state = new State();

      [ServicePort("/Controller", AllowMultipleInstances = true)]
      private ControllerOperations mainPort = new ControllerOperations();

    [SubscriptionManagerPartner]
    submgr.SubscriptionManagerPort _submgrPort = new submgr.SubscriptionManagerPort();
      private RobotController _controller = null;
      public Controller(DsspServiceCreationPort creationPort)
    : base(creationPort)
    { }

    protected override void Start()
      {
    SetupController();
    base.Start();
    }

    By adding the AllowMultipleInstances i assumed this would work properly but it does not function the way i want. Also the answers given on the forum lead me to believe that they are mostly answers on how to add multiple instances of a partner service within a service, but i want to create them within VPL.

    The settings i make for my VPL blocks are done within VPL, not using a manifest and this is the way we want it to behave.

    I must be missing something and the answers that i found on the forums here do not seem to be helping me along with this unless i am missing something here.

    Thursday, October 24, 2013 12:14 PM

Answers

  • Ken, I strongly recommend not making anything complex with VPL. Experience has shown that its very hard to debug VPL diagrams of even moderate size, and the extra layer it adds, adds to the confusion.

    If you are comfortable with C# and .Net - just use that. Also keep in mind, .Net 4.5 has terrific elements for parallel processing (tpl dataflows, RX) that supersede CCR, .Net remoting and TCP libraries supersede DSS.

    Saturday, October 26, 2013 3:52 AM
    Moderator