Skip to content

Commit

Permalink
Prepare for hex.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
pma committed Mar 24, 2015
1 parent 910fc6d commit c89b05b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 Paulo Almeida

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Phoenix Pubsub - RabbitMQ Adapter
=================================

RabbitMQ adapter for Phoenix's PubSub layer.
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, github: "pma/phoenix_pubsub_rabbitmq"}]
[{:phoenix_pubsub_rabbitmq, "0.0.1"}]
end
```

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

```elixir
def application do
Expand All @@ -25,19 +25,28 @@ Edit your Phoenix application Endpoint configuration:

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


The following options are supported:

* `name` - The required name to register the PubSub processes, ie: `MyApp.PubSub`
* `options` - The optional RabbitMQ options:
* `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 hearbeat interval in seconds (defaults to `0` - turned off);
* `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
19 changes: 18 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ defmodule Phoenix.PubSub.RabbitMQ.Mixfile do
[app: :phoenix_pubsub_rabbitmq,
version: "0.0.1",
elixir: "~> 1.0",
deps: deps]
description: description,
package: package,
source_url: "https://github.com/pma/phoenix_pubsub_rabbitmq",
deps: deps,
docs: [readme: "README.md", main: "README"]]
end

def application do
Expand All @@ -16,4 +20,17 @@ defmodule Phoenix.PubSub.RabbitMQ.Mixfile do
[{:poolboy, "~> 1.4.2"},
{:amqp, "~> 0.1.0"}]
end

defp description do
"""
RabbitMQ adapter for the Phoenix framework PubSub layer.
"""
end

defp package do
[files: ["lib", "mix.exs", "README.md", "LICENSE"],
contributors: ["Paulo Almeida"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/pma/phoenix_pubsub_rabbitmq"}]
end
end

0 comments on commit c89b05b

Please sign in to comment.