ADLINK-IST / opensplice

This is the Vortex OpenSplice Community Edition source repository. For our commercial offering see
https://www.adlinktech.com/en/vortex-opensplice-data-distribution-service
Apache License 2.0
259 stars 157 forks source link

How to write id in program instead of using default id #118

Closed ZTY-star closed 4 years ago

ZTY-star commented 4 years ago

opensplice examples all use the default id,like this:dds::domain::DomainParticipant(org::opensplice::domain::default_id()),but how to pass in the self-defined domain ID, and what is the value range of the domain ID.

ThijsSassen commented 4 years ago

@ZTY-star please see the Tutorial section 1.3.4 you can just pass it as an integer. Its recommended to use a domainId in the range of 0 - 230 for maximum interoperability see also the deploymentguide section 12.2.2

ZTY-star commented 4 years ago

@ZTY-star please see the Tutorial section 1.3.4 you can just pass it as an integer. Its recommended to use a domainId in the range of 0 - 230 for maximum interoperability see also the deploymentguide section 12.2.2

However, the id value is related to the id value defined in the OSPL.xml file. Only when the id value set in the program is the same as the value in the configuration file can the program run. How can this be solved? The goal I want to achieve is to set the id value freely.Thankyou

ThijsSassen commented 4 years ago

@ZTY-star the domainId you are using in your application will be set inside the ospl.xml. When using default_id() the system will look inside the ospl.xml and use the domain id that if specified there. You cannot set a domain ID at runtime. it can only be done before starting the application.

ZTY-star commented 4 years ago

@ZTY-star the domainId you are using in your application will be set inside the ospl.xml. When using default_id() the system will look inside the ospl.xml and use the domain id that if specified there. You cannot set a domain ID at runtime. it can only be done before starting the application.

I don't want to use default_id (), I want to specify a certain id myself before running, like this dds :: domain :: DomainParticipant dp (3), but if the program wants to run, id must be set to 3 in the configuration file , I want to get rid of the shackles of the configuration file.

ThijsSassen commented 4 years ago

@ZTY-star you can use environment variables in the configuration file i.e.

${ID} then before you start your example you can set this ID variable to a value and use that also in your application.
ThijsSassen commented 4 years ago

closing this as answered