BonFIRE logo and link to main BonFIRE site

Table Of Contents

Previous topic

Notifications

Next topic

Event structure

This Page

Notification Service

BonFIRE offers a way for clients to subscribe to notifications sent when the experiment state changes, and when resources are created, updated, or destroyed.

For example, your compute resources may be interested to know when the experiment state transition into the stopped state (see Experiment Lifecycle), so that they can start a backup process or some custom shutdown procedure before the experiment ends.

The way BonFIRE does this is to publish state transition events into a message queue (we’re using RabbitMQ), to which you (meaning: some script written by you) can subscribe.

Event format

All messages that you will receive are JSON, formatted in either a simple or more detailed structure:

Simple messages:

timestamp the UNIX timestamp at which the event occurred
type type of the resource (experiment, compute, network, storage)
status the updated status of the target resource
path the path to the resource in the BonFIRE API (e.g. /experiments/1234)

Detailed messages:

timestamp the UNIX timestamp at which the event occurred
objectType type of the resource (experiment, compute, network, storage, site_link)
eventType the updated status of the target resource (create, state, update, delete). See State section
objectId the path to the resource in the BonFIRE API (e.g. /experiments/1234)
source module or site from which the event is sent (e.g. res-mng, be-ibbt)
groupId group that triggers the event notification
userId user that triggers the event notification
objectData extra information to recreate the entire object. See objectData section

Check the Event structure section for further details and sample messages.

Prerequisites

You should find a library that talks the AMQP protocol, for your language of choice. Here are a few suggestions:

You’ll also need to know the following connection parameters:

host mq.bonfire-project.eu
port 5672
username eventReader
password reader1348
vhost bonfire
exchange experiments
routing_key experiment specific

Note that the guest user is only allowed to create server-generated queues (i.e. queues with empty names in most of the AMQP libraries).

Your queue must bind to the experiments exchange and must specify a routing_key specific to your experiment. You may check Using the RabbitMQ Notification Service for connection examples on various languages.