If you are running multiple instances of the same application, either on a single VM/server/container, or across multiple hosts, it is often useful to assign each instance a unique ID.
You can provide an instance ID, to each instance of your application via a command line argument which is then made available to your application components if they need it.
Providing an ID via the command line
Start your application with the
-i argument. E.g.:
myapp -i myid
You will see a message similar to:
29/Oct/2019:11:01:08 Z INFO [grncInit] Instance ID: myid
Accessing the ID from your components
If your component implements instance.Receiver
(e.g. implements the method
RegisterInstanceID(*instance.Identifier)), the instance ID will be passed in to that
method before the container starts your components.
Next: System configuration
Prev: Instance identification