Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pma/phoenix_pubsub_rabbitmq
RabbitMQ adapter for Phoenix's PubSub layer
https://github.com/pma/phoenix_pubsub_rabbitmq
Last synced: 3 months ago
JSON representation
RabbitMQ adapter for Phoenix's PubSub layer
- Host: GitHub
- URL: https://github.com/pma/phoenix_pubsub_rabbitmq
- Owner: pma
- License: mit
- Created: 2015-02-24T22:11:33.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T04:57:01.000Z (over 9 years ago)
- Last Synced: 2024-10-02T21:17:47.464Z (4 months ago)
- Language: Elixir
- Size: 164 KB
- Stars: 45
- Watchers: 2
- Forks: 23
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - RabbitMQ adapter for Phoenix's PubSub layer. (Framework Components)
- fucking-awesome-elixir - phoenix_pubsub_rabbitmq - RabbitMQ adapter for Phoenix's PubSub layer. (Framework Components)
- awesome-elixir - phoenix_pubsub_rabbitmq - RabbitMQ adapter for Phoenix's PubSub layer. (Framework Components)
README
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.
```elixir
def deps do
[{:phoenix_pubsub_rabbitmq, "0.0.1"}]
end
```You should also update your application list to include `:phoenix_pubsub_rabbitmq`:
```elixir
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