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

feat: store events in sqlite, delete only on ack #360

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

feat: store events in sqlite, delete only on ack #360

wants to merge 18 commits into from

Conversation

de-sh
Copy link
Contributor

@de-sh de-sh commented Sep 28, 2024

Closes #

Changes

Enables a webserver that accepts data events as HTTP requests, responding with a status 200 response only when uplink successfully writes the message to sqlite. This ensures that the event is not lost, as the message will only be deleted from sqlite once the broker acknowledges it, ensuring the data point has reached the broker atleast once.

Why?

Customer wants to send low frequency, "event" based data points to the platform and ensure guaranteed delivery once message is acknowledged by uplink,

Trials Performed

$ time curl -X POST http://localhost:4321/event -d "{\"stream\": \"example\", \"sequence\": 1, \"timestamp\": $(date +%s%3N) }" -H 'Content-Type: application/json'

________________________________________________________
Executed in    3.38 secs      fish           external
   usr time    4.69 millis    0.00 micros    4.69 millis
   sys time    4.64 millis  834.00 micros    3.80 millis
  2024-09-28T19:02:22.734044Z  INFO uplink::collector::events: Starting uplink event server: 0.0.0.0:4321

  2024-09-28T19:02:24.201251Z  INFO uplink::collector::events: Event received on stream: example

  2024-09-28T19:02:27.909987Z DEBUG uplink::collector::events: Event has reached broker on topic: /tenants/edge/devices/1/events/example/jsonarry

@de-sh de-sh marked this pull request as ready for review October 2, 2024 06:11
@de-sh de-sh requested a review from tekjar October 2, 2024 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant