Page MenuHomeDevCentral

Broker and notifications system
ClosedPublic

Authored by dereckson on Dec 18 2015, 16:49.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 11:52
Unknown Object (File)
Thu, Dec 12, 12:43
Unknown Object (File)
Wed, Dec 11, 23:38
Unknown Object (File)
Wed, Dec 11, 09:54
Unknown Object (File)
Wed, Dec 11, 00:28
Unknown Object (File)
Wed, Dec 11, 00:05
Unknown Object (File)
Sun, Dec 8, 16:20
Unknown Object (File)
Sun, Dec 8, 11:29
Subscribers
None

Details

Summary

Broker client

Any application having something interesting to broadcast can publish
a notification to our broker, directly or through the notificaitons center.

We have an AMQP client to connect to the broker.

Fixes T616.

Notifications

Every second, Wearg reads the notifications queue and will broadcast
notifications.

We provide an notifications handler to send notifications to the right IRC channels.

Fixes T581.

Bot setup

First, this requires a TCL extension to inteact with an AMQP client
(see dereckson/rabbitmq-tcl).

To use this:

source Wearg/Broker.tcl
source Wearg/Notifications.tcl
notifications::init
broker::init

Note: don't forget the notifications::init: if you don't bind the notifications
before starting to get messages, they will be lost.

To recover after an issue, broker::on_tick should be enough to restart the timer
(check utimers to know if you've lost one on an error)

Extend the code

To get a notification: notifications::bind <service> <projec> <group> <type> <callback procedure>.

The callback procedure will get service project group rawContent type text link as arguments.

To get a broker message: broker::bind <queue> <callback procedure>

The callback procedure wil lget queue message as arguments.

Test Plan

Live test with a notification of each kind from GitHub

Diff Detail

Repository
rVIPERSERV ViperServ scripts [legacy Mercurial repo]
Lint
No Lint Coverage
Unit
No Test Coverage
Branch
master (bookmark) on default (branch)
Build Status
Buildable 126
Build 126: arc lint + arc unit

Event Timeline

dereckson retitled this revision from to Broker and notifications system.
dereckson updated this object.
dereckson edited the test plan for this revision. (Show Details)
dereckson added a reviewer: dereckson.
dereckson added inline comments.
Wearg/Broker.tcl
20

That's for core.

66

This message is temporary to evaluate how many times it occurs.

76

That requires info exists brokerbinds too (see Notifications.tcl).

Wearg/Notifications.tcl
98

This code is also temporary: GitHub sends notification for a lot of different events, and all aren't yet ready in the notifications center.

Wearg/Notifications.tcl
6

We could avoid to hardcode this one.

dereckson marked 2 inline comments as done.
dereckson edited edge metadata.
  • Moved is_package_present to core
  • Don't hardcode broker notifications queue (registry set broker.queues wearg-notifications on Wearg)
  • Added info exists to check if the global variable brokerbinds exists
dereckson edited edge metadata.
This revision is now accepted and ready to land.Dec 18 2015, 17:09
This revision was automatically updated to reflect the committed changes.