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: on_event can subscribe to multiple endpoints at once #1881

Merged
merged 2 commits into from
Aug 29, 2023
Merged

feat: on_event can subscribe to multiple endpoints at once #1881

merged 2 commits into from
Aug 29, 2023

Conversation

chubei
Copy link
Contributor

@chubei chubei commented Aug 21, 2023

Interface change:

Old:

// Request for `OnEvent`.
message OnEventRequest {
  // The event type to subscribe to.
  dozer.types.EventType type = 1;
  // The name of the endpoint to subscribe to.
  string endpoint = 2;
  // JSON filter string.
  optional string filter = 3;
}

New:

// Request for `OnEvent`.
message OnEventRequest {
  // The endpoints to subscribe to. Key is the endpoint name, value is the filter.
  map<string, dozer.types.EventFilter> endpoints = 1;
}

// Event filter.
message EventFilter {
  // The event type to subscribe to.
  dozer.types.EventType type = 1;
  // JSON filter string.
  optional string filter = 3;
}

@snork-alt
Copy link
Contributor

Would the request look like this @chubei ?

grpcurl -d '{"endpoints": {"trips": {"type": "ALL", "filter": "{\"PULocationID\": 211}"}}}' \
    -plaintext localhost:50051 dozer.common.CommonGrpcService/OnEvent

@chubei
Copy link
Contributor Author

chubei commented Aug 23, 2023

@snork-alt

grpcurl -d '{ "endpoints": [{ "key": "trips", "value": { "type": "ALL", "filter": "{\"PULocationID\": 211}"} }] }'\
    -plaintext localhost:50051 dozer.common.CommonGrpcService/OnEvent

@chubei
Copy link
Contributor Author

chubei commented Aug 23, 2023

@snork-alt this is clearer

grpcurl -d '{
    "endpoints": [
        {
            "key": "trips",
            "value": {
                "type": "ALL",
                "filter": "{\"PULocationID\": 211}"
            }
        }
    ]
}' -plaintext localhost:50051 dozer.common.CommonGrpcService/OnEvent

@snork-alt
Copy link
Contributor

Instead of key and value then, why not use endpoint and filter ?

@chubei
Copy link
Contributor Author

chubei commented Aug 23, 2023

Instead of key and value then, why not use endpoint and filter ?

"key" and "value" is just the syntax of proto json to write a map. It's not part of our code. See description of the PR.

@chubei chubei requested a review from snork-alt August 24, 2023 08:22
@chubei chubei enabled auto-merge August 29, 2023 11:43
@chubei chubei added this pull request to the merge queue Aug 29, 2023
Merged via the queue into getdozer:main with commit f078419 Aug 29, 2023
5 checks passed
@chubei chubei deleted the feat/event branch August 29, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants