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.
Vagrant and stuff?
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
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)
To run the application issue:
$ lein run
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)
At this point Akvo-notifications require a running RabbitMQ to be able to run:
brew install rabbitmq
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)
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!"
A "map" of the REST:ish API is available at the root resouce. The API supports JSON & EDN. Resources don't use trailing slashes.
Copyright (C) 2014 Stichting Akvo (Akvo Foundation)
Distributed under the GNU Affero General Public License (AGPL)