Wrappers subscribing to data streams?
Opened this issue · 3 comments
I was just curious if it was possible for wrappers to subscribe to data streams for outbound messaging? For example, if I created a wrapper for my device, is it possible for the wrapper to subscribe to a data stream that has published commands for the device?
Sorry if I didn't understand correctly your question, but do you mean that the wrapper would be an endpoint that is registered for calling back by any publish/subscribe external service or device?
Or do you means that the wrapper would be able to send commands to the external service or device?
In both cases the answer is yes, you just need to write a bit of code (one class implementing the AbstractWrapper).
If you have a bit more details about the protocol, I can also help you writing it.
If I can clarify a bit more. In our current system, data can move in two directions, from the device to the data center and from the data center to the device. Since GSN is a publish/subscribe system, I was curious if data published by a virtual sensor at the data center could be subscribed to by a wrapper, the wrapper would be programmed to send data/commands to the device. I was interested if the API for programming wrappers had support for subscribing to data streams.
If you use the remote or zeromq wrappers, they can connect to a virtual sensor and subscribe to its data stream.
But for the use case you are describing I would rather implement the sendToWrapper
callback on the wrapper side to forward command to the device and have the computation of which command to send at the VirtualSensor level (which will then call the sendToWrapper method when necessary).