Altinn / altinn-events

Altinn platform microservice for handling events
MIT License
1 stars 2 forks source link

Wildcard support on event type filter for subscriptions #550

Open chrrust opened 1 week ago

chrrust commented 1 week ago

Description

It would be useful with support for wildcards as part of the event type filter when creating subscriptions.

Today, if I want to subscribe to multiple events with one subscription, I'd need to omit the event type filter all together. This would make me subscribe to all events on the given resource.

However, not all events on that resource is relevant. Therefore it would be nice to be able to specify a wildcard to subscribe to only a subset of events for a given resource. In the context of the DGM project, this could for instance be specified by no.dgm.v1.funeral.* or no.dgm.v1.next-of-kin.*.

Additional Information

As far as I know there are 3 workarounds for this that would work, but they may be less friendly and less efficient than a simple event type wildcard:

  1. The first one is to subscribe to all events and on client side filter the events you receive on event type.
  2. The second one(basically same as first one), is to create a dedicated resource for the events that are relevant. Then subscribe without an event filter. This would require managing more resources than necessary.
  3. Use a custom proprietary attribute on the cloud events to specify the sub-types. Then you would be able to have an event named for instance no.dgm.v1.funeral and have a custom attribute with a value like created. The subscription could then specify no.dgm.v1.funeral and on client side deserialize the data property based on the value of the custom attribute
acn-sbuad commented 1 week ago

Requirements for the solution from the team: