Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue barcode event messages per notifier #27

Closed
markusressel opened this issue Dec 19, 2020 · 1 comment · Fixed by #29
Closed

Queue barcode event messages per notifier #27

markusressel opened this issue Dec 19, 2020 · 1 comment · Fixed by #29
Assignees
Labels
enhancement New feature or request

Comments

@markusressel
Copy link
Owner

markusressel commented Dec 19, 2020

Is your feature request related to a problem? Please describe.
The MQTT / HTTP / Websocket connection can be lost temporarily due f.ex. network issues, which can result in the loss of barcode events on the client side.

Describe the solution you'd like
Implement an event queue, which stores events temporarily when the connection drops, to be able to resend them when the connection is reestablished.

For the MQTT and HTTP notifiers, a simple (infinite) retry loop should be sufficient.

For websocket clients, events should be queued per client.

Since the queue could become very large over time when the service uptime is really long, events in the queue of individual clients should be automatically dropped when they are older than a specified amount of time. This should default to 2 hours and be user configurable via the YAML config file.

@markusressel markusressel added the enhancement New feature or request label Dec 19, 2020
@markusressel markusressel self-assigned this Dec 19, 2020
@markusressel
Copy link
Owner Author

Implementing message queuing for temporarily disconnected websocket is difficult, since there is no unique identifier of websocket clients between connections. For this reason it will not be implemented for this issue, and is moved to #28 instead.

@markusressel markusressel changed the title Queue barcode event messages per notifier entry Queue barcode event messages per notifier Dec 20, 2020
markusressel added a commit that referenced this issue Dec 20, 2020
* added event_queue processing to BarcodeNotifier
reworked websocket event messages into WebsocketNotifier
added BarcodeEvent data class for easier passing around
added type info
added comments
added docs

* added date property to BarcodeEvent data class
added config option for event drop timedelta threshold
drop events older than threshold
added config option for retry interval
improved error handling

* added "date" parameter to BarcodeEvent constructor
added "date" to event json
added simple test
updated README

* date fix
removed unused comments

* added autoreconnect to websocat example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant