Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.13 KB

README.md

File metadata and controls

53 lines (36 loc) · 2.13 KB

ElixirMQ

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.

Endpoints

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.

Pages

  • List of consumers /api/consumers
  • List consumers by topic /api/consumers/topic/<topic>

Development Guide

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.

Initializing Project

If this is your first time, you are required to initialize the project:

  1. enter nix shell using nix-shell shell.nix
  2. create the db directory initdb ./db (inside your mix project folder)
  3. start the postgres instance pg_ctl -o "-k /tmp" -l "$PGDATA/server.log" start
  4. create the postgres user createuser -h /tmp postgres -ds
  5. create the db createdb -h /tmp db
  6. add the /db folder to your .gitignore
  7. change directory into cd src
  8. follow steps in src/README.md to run Phoenix server
  9. Happy developing!

Developing Project

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