vectorgrp / sil-kit

Vector SIL Kit – Open-Source Library for Connecting Software-in-the-Loop Environments
https://vectorgrp.github.io/sil-kit-docs
MIT License
107 stars 32 forks source link

registryUri in participant configuration file #130

Closed kocho1984 closed 3 weeks ago

kocho1984 commented 1 month ago

Hi,

Is there a possibility to put registrUri in configuration file for the participant?

MariusBgm commented 1 month ago

Hi @kocho1984 , sure you can add it into the middleware section of the participant's configuration, see https://vectorgrp.github.io/sil-kit-docs/configuration/middleware-configuration.html For Example, the participantConfiguration.yaml would contain the following:

Middleware:
  RegistryUri: silkit://localhost:1234
kocho1984 commented 3 weeks ago

@MariusBgm, is there any easy way to get IP and listening port of sil-kit-registry from IParticipantConfiguration? I have a config file with following entry and I would like to check in the code using SilKit API what IP and port is in the config.

Middleware:
  RegistryUri: silkit://55.55.55.55:8500
VDanielEdwards commented 3 weeks ago

Hello @kocho1984, no this is not possible. The configuration itself is a 'black box' for the application that loads / or uses it.

VDanielEdwards commented 3 weeks ago

If you don't mind me asking, what do you need the registry URI for?

kocho1984 commented 3 weeks ago

I would like to check if IP is available and listening on that port. I have to do that before creating a participant.

VDanielEdwards commented 3 weeks ago

The connection to the registry is attempted during the call to CreateParticipant. If the connection fails, eg., if it runs into a timeout, or whatever is listening on the port isn't 'speaking' the SIL KIt network protocol like a HTTP server, an exception is thrown which you could catch.

VDanielEdwards commented 3 weeks ago

Additionally, SIL Kit will not just try to connect via TCP. At the moment we also attempt to connect via local-domain sockets using a 'predictable' name. But we might add further transports in the future, in addition to the existing ones.