Home

Awesome

Public Event Dispatcher

A set of Azure Functions to dispatch IO core domain events to IO-powered project that may need a specific integration. Such projects should expose a webhook url to which this applicative can perform a http request.

This application's responsibilities are:

Events

Incoming events are processed and propagated only when and to whom need to be notified. This application introduces two kind of events:

Events flow edit

Public Events

List of all Public Events emitted to registered webhooks

EventPayloadDescriptionRequired attributes
pingname: the name of the webhook to be pingedJust a ping on a registered webhook, used for testing the system. This event is used mainly for testing purposes.name
service:subscribedserviceId, fiscalCodeEmitted when a Citizen subscribes to a ServiceserviceId

NonPublic Events

List of all Non-Public Events received by the application. These are the events that are accepted by the dispatcher, but will be then re-mapped into public events.

EventPayloadDescriptionRequired attributes
ping:all-Just a ping on ALL registered webhooks, used for testing the system. This event is used mainly for testing purposes.-
profile:completedfiscalCode, servicePreferencesModeWhen a Citizen completes their onboarding process on IO. This may emit service:subscribed for every registered downstream services-
profile:service-preferences-changedfiscalCode, servicePreferencesMode, oldServicePreferencesModeWhen a Citizen changes how they want to handle Service subscriptions. This may emit service:subscribed for every registered downstream services-

Testing

Integration tests are defined into __integrations__ folder. Tests are performed in a containerized, isolated context so that are reproducible at any time and in every environment. A test agent is used to act as both event producer and webhook consumer, so that it can verify the correct executions of workflows. The following is a simple schema that gives the idea:

Events flow edit

Run tests

# an already-built application is supposed
yarn install --frozen-lockfile
yarn build

cd __integrations__

# start the containerized environment
docker-compose up

# execute tests
yarn install --frozen-lockfile
docker exec integrations___testagent_1 yarn start
#           ^^^ FIXME: reference container using a less arbitrary name