Project description:
I have a simple demo project with OSGi. The Domain is a weather station which has multiple sensor types. Each sensors sends its data to the weather station. Via an API the data is exposed and visualized on a website via a plot.
Goal:
E.g: I currently have three different sensor types. One for measuring the wind speed, temperature and humidity. The weather station should have multiple wind sensor instances (Cardinality.MULTIPLE).
Status quo:
Currently I am solving this with creation of a WindSpeedSensor and a WindSpeedAdvancedSensor service. I already have implemented a custom command for Apache Karaf where I can send specific configuration commands to my service. So the sensor can be configured to generate measurements in a specific range.
Desired condition:
An optimal solution would be to start additional instances of WindSpeedSensor via Karaf commmand line. The should not be the need of artificial WindSpeedSensors to achieve the goal of multiple services for the WeatherStation class.
Question:
How can I achieve this? I am new to OSGi and declarative services and I am curious how experts in OSGi solve this. Thanks in advance for your time and feedback.