Application construction components - Altinn Platform Events

The Events component in Altinn platform is constructed as an core web API application deployed as a docker container to a Kubernetes cluster.

The Events components expose REST-APIs for publishing and subscribing to events.

When a publish request is received it will push the event document to the event storage. When a request is received it will query the events stored in the event storage.

Api controllers

The following API controllers are defined

  • EventsController : responsible for registrating events and pull of events for consumers.
  • PushController : responsible to validate if there is any subscriptions matching the event and if so authorize the subscriper before it pushes the event to the outbound queue
  • SubscriptionController : responsible for managing subscriptions for consumers.


The eventscontroller in the Events component is the one receiving events from Apps and other sources.

It verifies if the app is authorized to creates events for the given source and then store in to event storage

Push Events controller

Push Events controller is called by the InboundEventsController. Based on details from the Event it will identify matching subscriptions. For each match it will authorize the consumer using the Policy Authorization Point.

The AuthorizationHelper is responsible for creating and performing the request.

Event storage

To be able to get the search capability needed for the Events component we have choosen to use PostgreSQL.

Using PostgreSQL makes is possible to sort the events based on a primary key and also makes it possible to search over all events based on subject or source.

The suggested table structure

   subject VARCHAR NOT NULL,
   time timestamptz NOT NULL,
   cloudevent TEXT NOT NULL

Event sequencing

Events will be sequnced by sequence number that is the primary key of the Events table.


We would need to have index on


As part of the Event Component there is 3 Azure Functions used for pushing events to the consumers. Click on name for code.


The EventsInbound function is triggered by QueueStorage changes in the “events-inbound” queue.

It just forward the event to the PushController through the pushEventService.

The Function uses Platform Access token to authenticate itself for the PushController

It uses standard mechanismen for retry, if the call for pushcontroller fails.


The EventsOutbound function is triggered byQueueStorage changes in the “events-outbound” queue.

It will try to push the event to given subscription endpoint given in the CloudEventEnvelope that is put on the queue and containing the event.

This function is configured with CustomQueueProcessorFactory to handle retry if it is not possible to push event to the endpoint.

It will try send the event right away, but if the request to webhook fails it will put the cloudevent back on the queue with a defined wait time.

  1. retries after 10 seconds
  2. retries after 30 seconds
  3. retries after 1 minute
  4. retries after 5 minutes
  5. retries after 10 minutes
  6. retries after 30 minutes
  7. retries after 1 hour
  8. retries after 3 hours
  9. retries after 6 hours
  10. retries after 12 hours
  11. retries after 12 hours

If it fails the 12. time it will put the event in the dead letter queue and will not try again.