Giter Club home page Giter Club logo

phoenix_pubsub_rabbitmq's Introduction

Phoenix Pubsub - RabbitMQ Adapter

RabbitMQ adapter for the Phoenix framework PubSub layer.

Usage

Add phoenix_pubsub_rabbitmq as a dependency in your mix.exs file.

def deps do
  [{:phoenix_pubsub_rabbitmq, "0.0.1"}]
end

You should also update your application list to include :phoenix_pubsub_rabbitmq:

def application do
  [applications: [:phoenix_pubsub_rabbitmq]]
end

Edit your Phoenix application Endpoint configuration:

  config :my_app, MyApp.Endpoint,
    ...
    pubsub: [name: MyApp.PubSub,
             adapter: Phoenix.PubSub.RabbitMQ,
             options: [host: "localhost"]

The following options are supported:

  * `host` - The hostname of the broker (defaults to \"localhost\");
  * `port` - The port the broker is listening on (defaults to `5672`);
  * `username` - The name of a user registered with the broker (defaults to \"guest\");
  * `password` - The password of user (defaults to \"guest\");
  * `virtual_host` - The name of a virtual host in the broker (defaults to \"/\");
  * `heartbeat` - The connection hearbeat interval in seconds (defaults to `0` - turned off);
  * `connection_timeout` - The connection timeout in milliseconds (defaults to `infinity`);
  * `pool_size` - Number of active connections to the broker

Notes

  • An Exchange is declared with the name of the Phoenix PubSub server (example: MyApp.PubSub)
  • When subscribing to a topic:
    • a Queue with a server assigned name is declared;
    • the Queue is bound to the Exchange using the topic as routing key;
    • a consumer process is started. The consumer will ack each message in the Queue as it sends the payload to the subscriber pid;
  • Can be used when distributed Erlang is not an option (like when deploying to Heroku); when RabbitMQ is already a dependency (instead of Redis);
  • Uses RabbitMQ routing mechanism, delivering a message directly to a consumer process

phoenix_pubsub_rabbitmq's People

Contributors

pma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.