locked
Regarding the different values for CreationPolicy when defining Partners RRS feed

  • Question

  • Hello all:

    Being a newbie, as I am regarding MSRS, I have some doubts concerning some instructions that, I guess, are so simple for the most of the users of these forums. I hope I am not asking an already asked question and I am posting this in the proper place.

    My main doubt in here is related to the partnership, and more precisely related to the creation policy for partner services.

    I have been looking for some information on the internet about that statement and the several values that can be assigned to it and I have found the definition for them but I still can not understand properly when should I use one or the others. In fact, I am reading Sara Morgan's Programming Microsoft Robotics Studio book through and I understand everything in the code examples shown but the CreationPolicy statement. Moreover, in some examples more than one value is used for different services.

    So, my (composed) question is: How, when and why should I decide to use one determined value between those four (UsePartnerListEntry, UseExisting, UseExistingOrCreate or CreateAlways)? Moreover, what are the differences between them four?

    Thanks in advance.

    I look forward to hearing from you.
    Best regards,
    Rober
    • Edited by soyelmilonga Monday, February 15, 2010 8:09 PM Mispelling in one word
    Monday, February 15, 2010 8:08 PM

Answers

  • As far as I know :
    - UsePartnerListEntry : The partner must be explicitly given (with a manifest, with a query to constructor service)
    - UseExisting : The service searches the current node for a partner that implements the partner contract. The first found is set as partner. Timeout error on failure
    - UseExistingOrCreate : Same as UseExisting, but on failure, it will create a new service instance on the current node
    - CreateAlways : Creates a new instance of the service and sets it as partner

    UsePartnerListEntry is a good "default" option. When you implement a service that needs generic partner or that will be used in different situations, the UsePartnerListEntry is a good option to be sure that the service is deployed with a well know binding.

    UseExisting/UseExistingOrCreate could be useful when the partner service instance doesn't matter. With these policies, you don't have to explicilty write the relationship between services, you just use the first you get.

    CreateAlways is useful if you need a unique instance of the partner for each service instances. A good example is the DSS subscription manager service.

    Regards,
    Vincent


    http://www.simplysim.net/
    • Marked as answer by soyelmilonga Wednesday, February 17, 2010 9:19 AM
    Tuesday, February 16, 2010 7:32 AM
  • Yes, you are right ;)
    If you defined a partner with UsePartnerListEntry policy and you don't specify the partner with a manifest (or a create request), the service can't run and raises an error.

    Regards,
    Vincent
    http://www.simplysim.net/
    • Marked as answer by soyelmilonga Wednesday, February 17, 2010 9:20 AM
    Wednesday, February 17, 2010 7:36 AM

All replies

  • As far as I know :
    - UsePartnerListEntry : The partner must be explicitly given (with a manifest, with a query to constructor service)
    - UseExisting : The service searches the current node for a partner that implements the partner contract. The first found is set as partner. Timeout error on failure
    - UseExistingOrCreate : Same as UseExisting, but on failure, it will create a new service instance on the current node
    - CreateAlways : Creates a new instance of the service and sets it as partner

    UsePartnerListEntry is a good "default" option. When you implement a service that needs generic partner or that will be used in different situations, the UsePartnerListEntry is a good option to be sure that the service is deployed with a well know binding.

    UseExisting/UseExistingOrCreate could be useful when the partner service instance doesn't matter. With these policies, you don't have to explicilty write the relationship between services, you just use the first you get.

    CreateAlways is useful if you need a unique instance of the partner for each service instances. A good example is the DSS subscription manager service.

    Regards,
    Vincent


    http://www.simplysim.net/
    • Marked as answer by soyelmilonga Wednesday, February 17, 2010 9:19 AM
    Tuesday, February 16, 2010 7:32 AM
  • Hello Vicent,

    Thank you very much for your quick reply.

    So, if I understood properly, in case of using a particular contract for a specific robot UsePartnerListEntry should be used in order to use the particular service and not a general one, isn't it?

    Moreover, in case of using a general service when partnering, UseExisting/UseExistingOrCreate should be OK. Am I right?

    In addition, I guess that if I load all the services I need in the manifest file, UsePartnerListEntry should be enough for loading all the instances I need. Again, am I right?

    Thank you very much again.

    Best regards,
    Rober
    Tuesday, February 16, 2010 10:11 AM
  • Yes, you are right ;)
    If you defined a partner with UsePartnerListEntry policy and you don't specify the partner with a manifest (or a create request), the service can't run and raises an error.

    Regards,
    Vincent
    http://www.simplysim.net/
    • Marked as answer by soyelmilonga Wednesday, February 17, 2010 9:20 AM
    Wednesday, February 17, 2010 7:36 AM
  • Thank you very much again. I absolutely appreciate your help :-)

    I think everything is clear to me now.

    Best regards,
    Rober
    Wednesday, February 17, 2010 9:19 AM