Domain Events
Domain Events is a mechanism for notifying external clients of internal events in Stream/Flow. A client can register a subscription for domain events, together with a URL where notifications can be posted to. When an event occurs in the system, Flow will send a notification to Azure EventGrid, which in turn will notify registered subscribers. Normally, notification will be performed using POST calls to registered webhook urls, containing a payload with a json message with the event type, event date and any associated data such as CaseId.
A big difference between the legacy webhook API and the domain events is that now you don’t subscribe to individual event types. A domain event subscription, once setup, will result in a stream of all event types being posted to the destination URL. It is the responsibility of the webhook receiver to filter out the event types of interest.
Contact support if you need to create a domain event subscription for your integration, as this must be set up by Broker AS. Azure EventGrid requires that systems that receive events by webhook validate the receiving endpoint within a short timeframe after subscription creation. See further details.
The WebHook payload will always contain as little information as possible, and it will be up to the integrator to use the Flow API to fetch extra information if needed.
It is important that the service that receives webhooks from Flow does so quickly. Any event processing must be decoupled from the process of receiving the webhook, in order to reduce latency and risk of timeouts. Default timeout is set to 5 seconds.
For testing purposes you can use a service like webhook.site to set up an endpoint that receives an event.
It is important to note that we cannot guarantee that events are sent 100% of the time. EventGrid supports automatic re-notification on failure of delivery. Where delivery is critical it is recommended integrators have a backup plan (for instance a repeating job that does updates the data every night).
Domain Events will eventually completely supersede the webhooks functionality.