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

Introduce events system backed by streaming topics #352

Closed
nicoloboschi opened this issue Sep 5, 2023 · 0 comments · Fixed by #363
Closed

Introduce events system backed by streaming topics #352

nicoloboschi opened this issue Sep 5, 2023 · 0 comments · Fixed by #363
Labels
proposal Proposal of a new feature

Comments

@nicoloboschi
Copy link
Member

nicoloboschi commented Sep 5, 2023

Use case

As application developer, I want to listen to all gateway client new connections. I'd like to consume from a known "events" topic such events and react somehow, for example sending a message to the target topic with a welcome message.

Proposal

Since events would be useful in other scenarios (e.g. message process failed event) let's introduce a abstract event API which will be enhanced in the future. The first implementation would be to register clients opening/closing connections to the gateway.

gateways.yaml

gateways:
  - id: consume-output
    type: consume
    events-topic: events-topic

pipeline.yaml

topics:
  - name: "events-topic"
    creation-mode: create-if-not-exists

The API gateway will check for the app configuration and writes to the events topic if configured to do so.
The schema will be the same for all the events (even non about gateways). It will be in JSON and this format:

{
 "type": "ClientConnectedToGateway"|"ClientDisconnectedToGateway"
 "timestamp": <long timestamp>
  "source": {
     # this changes based on the type
     "gatewayId": "xxx",
     "applicationId": "zz",
     "tenant": "tt"
    },
  "data": { 
        # custom data depending on the event kind
       "params": {...}
       "userAgent": ....
   }
}
@nicoloboschi nicoloboschi added the proposal Proposal of a new feature label Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal of a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant