Accenture / reactive-interaction-gateway

Create low-latency, interactive user experiences for stateless microservices.
https://accenture.github.io/reactive-interaction-gateway
Apache License 2.0
590 stars 66 forks source link

Updating extractors during runtime #360

Closed actraiser closed 3 years ago

actraiser commented 3 years ago

I am running RIG from the latest docker build (3.0.0-Alpha-1) and I was wondering if the "Constraints & Extractors" handling has been made more flexible in 3.0.

Right now, I need to define every Extractor I want to use before-hand in extractor.json so RIG is picking those up at startup. Once this happened, I believe there is no way to update the extractor definitions via API, e.g. in the case that new events are introduced that also require constraints.

Since I am adding constrained events all the time to my services I need to touch extractor.json a lot (and reload RIG) which also became somewhat less maintainable due to its size. What I would like to do is to simply use some internal RIG API-Endpoint to update extractors on demand during runtime and I believe that is not possible at the moment.

Does this feature request make sense?

Greets -act

mmacai commented 3 years ago

Hi @actraiser, I believe we discussed such feature at some point with @kevinbader. Perhaps it's time to add it, @kevinbader?

actraiser commented 3 years ago

Hello @mmacai, alternatively it would be a relief to use wildcards in the extractor configuration so one could basically create namespaced events, e.g. say I want to implement a greeting service that emits many different type of greetings to be routed to specific users.

In the following altered example from your docs, any event that starts with "greeting." would be picked up by the extractor mechanism, e.g. greeting.friendly, greeting.hostile, greeting.formal,...

{
  "greeting.*": {
    "name": {
      "stable_field_index": 1,
      "event": {
        "json_pointer": "/data/name"
      },
      "jwt": {
        "json_pointer": "/username"
      }
    }
  }
}

This may be more trivial to implement than an API for dynamic extractor updates during runtime.

Greets -act