Page MenuHomeDevCentral

Broker and notifications system
ClosedPublic

Authored by dereckson on Dec 18 2015, 16:49.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 12:38
Unknown Object (File)
Sat, Nov 9, 06:43
Unknown Object (File)
Thu, Nov 7, 00:37
Unknown Object (File)
Mon, Nov 4, 18:37
Unknown Object (File)
Mon, Nov 4, 18:37
Unknown Object (File)
Mon, Nov 4, 18:37
Unknown Object (File)
Mon, Nov 4, 17:34
Unknown Object (File)
Fri, Oct 25, 08:52
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
Lint Not Applicable
Unit
Tests Not Applicable

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
19 ↗(On Diff #252)

That's for core.

65 ↗(On Diff #252)

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

75 ↗(On Diff #252)

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

Wearg/Notifications.tcl
97 ↗(On Diff #252)

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
5 ↗(On Diff #252)

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.