eclipse / hawkbit

Eclipse hawkBit™
https://projects.eclipse.org/projects/iot.hawkbit
Eclipse Public License 2.0
455 stars 187 forks source link

How to subscribe to all messages using DMF API (AMQP) #1216

Open richturner opened 2 years ago

richturner commented 2 years ago

The DMF API seems to behave like a request response API.

I was really hoping true publish subscribe behaviour would be possible; for example I want to listen for all and any changes to targets within a backend system so I can track state there for consumption within this backend system.

The docs suggest the DMF API is for such integrations but if it is only usable in a request response manner then I really don't see the benefit of it over the HTTP API.

I'm hoping I'm just missing something obvious here.

Many Thanks!

bogdan-bondar commented 2 years ago

Hi! You are partially right :) The DMF API is mainly targeting targets/clients and can really be seen as request/response API in this regard. However, the main benefit of DMF is the AMQP broker in the middle that facilitates asynchronous communication /queueing as well as batch processing of events/messages. It is mainly used by Gateways that sit between Hawkbit server and devices. If I got your intention correct you would like to have a pubsub mechanism in order to integrate some 3-rd party backend system as a subscriber, is it correct? Could you please describe your use-case in more details? Currently Hawkbit doesn't offer dedicated way to accomplish that, however we were considering to implement such plug-point. As a intermediate solution and if applicable to your use-case/infrastructure you could reuse the built-in Spring Cloud Bus capability of Hawkbit by configuring it within your backend service on the same virtual host in RabbitMQ (see https://cloud.spring.io/spring-cloud-bus/reference/html/). In this case you would be able to add listeners for all existing application events of Hawkbit (e.g. TargetCreatedEvent, RolloutStoppedEvent, etc.)

richturner commented 2 years ago

Thanks for the info; indeed we have a system which is the 'source of truth' for our devices and this system actually provisions the targets in Hawkbit and I was hoping I could subscribe to events to get status info for the targets from Hawkbit to show this information within our own device model.

It's not an urgent issue for now but its' good to know that there's some Spring mechanism that could be utilised if desired.

I'm sure our use case isn't that unusual and being able to subscribe to target information within Hawkbit would be useful for any IoT platform that has a digital representation of these targets also.