akvo / akvo-notifications

Turns business events into user notifications
GNU Affero General Public License v3.0
1 stars 1 forks source link

About Akvo notifications

Akvo notifications turns business events into user notifications. One could argue that the notification service twists the perspective from services to users. Making it possible to ask what happened in the system, from a user perspective.

Akvo-notifications is a Clojure application that listen to a AMQP Message Queue and make data available for services with a REST API built with Liberator. Akvo notifications is no longer under active development.

Status

Stories in Ready

Try Akvo notifications

Vagrant and stuff?

Usage

At the moment, to run akvo-notification needs to be able to connect to RabbitMQ. This should not be the case, but for now that is how it is :-(

When running the REST:ish API is available at localhost:3000

HTTP API

Uberjar

Default usage:

$ java -jar target/akvo-notifications-[...]-standalone.jar

If needed:

$ java -jar target/akvo-notifications-[...]-standalone.jar -h
Akvo notifications

usage: java -jar <path to jar> [options...]
Options:
  -wp, --web-port PORT            3000                 Web service port
  -dh, --data-host HOST           localhost            Datastore host
  -dp, --data-port PORT           5002                 Datastore port
  -qh, --queue-host HOST          localhost            Queue host
  -qp, --queue-port PORT          5672                 Queue port
  -qu, --queue-user USERNAME      guest                Queue username
  -qc, --queue-password PASSWORD  guest                Queue password
  -qv, --queue-vhost VHOST        /                    Queue vhost
  -qn, --queue-name QUEUE         akvo.service-events  Queue name
  -h, --help

Copyright (C) 2014 Stichting Akvo (Akvo Foundation)

Development

Leiningen

To run the application issue:

$ lein run

REPL

The project is setup to follow "Reloading" workflow. So easiest is to fire up a REPL and then use the convenience functions defined in dev/user.clj.

Often user/go, user/stop & user/reset will be used. But if user/reset don't succed we will need to refresh with clojure.tools.namespace.repl/refresh. This since the convenience functions will not be available in the repl.

Using Emacs & Cider a typical workflow is:

M x cider-jack-in
> (user/go)
make changes...
> (user/reset)
make changes...
> (user/reset)
> (user/stop)

RabbitMQ

At this point Akvo-notifications require a running RabbitMQ to be able to run:

More info is available at the RabbitMQ site

Once installed, enable the Management Plugin. To verify, start the server with rabbitmq-server and take a look at the web admin ui (username: guest, password: guest)

Python

In python/ there is a set of files to test sending things via RabbitMQ to the notification service.

$ cd python
$ ./setup.sh
$ source ./virt_env/env/bin/activate
$ python ./send-message.py
Message sent!
$ deactivate

This should make the notification service se a message containing "Haj from Python!"

API

A "map" of the REST:ish API is available at the root resouce. The API supports JSON & EDN. Resources don't use trailing slashes.

Contributions

Legal

Copyright (C) 2014 Stichting Akvo (Akvo Foundation)

Distributed under the GNU Affero General Public License (AGPL)