Poor man's message queue service written in Elixir-Phoenix. This project is now part of Functional Programming final project.
This project implements simple message queue using HTTP Protocol. Due to HTTP's half-duplex nature, consumer are required to provide callback URI when connecting to the service.
Please refer to Consumer Example.
Path | Payload | Description |
---|---|---|
POST /api/message_queue |
{ "topic" : "haskell" , "message" : "haskell is functional" } |
Send a message to a topic. |
POST /api/consumer |
{ "topic" : "haskell" , "url_callback" : "example.com/api" } |
Subscribe to a topic. |
- List of consumers
/api/consumers
- List consumers by topic
/api/consumers/topic/<topic>
The project use Nix Package Manager to make reproducible development environment. If you're new to Nix, please follow this guide to install Nix Package manager into your system.
If this is your first time, you are required to initialize the project:
- enter nix shell using
nix-shell shell.nix
- create the db directory
initdb ./db
(inside your mix project folder) - start the postgres instance
pg_ctl -o "-k /tmp" -l "$PGDATA/server.log" start
- create the postgres user
createuser -h /tmp postgres -ds
- create the db
createdb -h /tmp db
- add the
/db
folder to your.gitignore
- change directory into
cd src
- follow steps in
src/README.md
to run Phoenix server - Happy developing!
Everytime you wants to start developing, you have to run the postgres instance.
pg_ctl -o "-k /tmp" -l "$PGDATA/server.log" start
Don't forget to close the postgres socket when you finished
pg_ctl -o "-k /tmp" -l "$PGDATA/server.log" stop
exit # to exit nix-shell
(c) 2022