Redix.PubSub.Fastlane

Fastlane pattern based on Redix.PubSub interface for Elixir

Build StatusCoverage StatusHex.pmDeps Status

See the docs for more information.

TL;DR Example Phoenix app

About

Works as a simple wrapper over Redix.PubSub.

Main goal is providing a fastlane path for published events.

Imagine: You have a Main task, that depends on few subtasks, each with its own UUID & in they await for published event, but also must know the Main task ID within every event.

Ie:

Redix.PubSub.Fastlane.subscribe(MyApp.PubSub.Redis, "channel1", {pid, My.Fastlane, ["some_id"]})

Installation

redix_pubsub_fastlane can be installed as:

  1. Add redix_pubsub_fastlane to your list of dependencies in mix.exs:
def deps do
[{:redix_pubsub_fastlane, "~> 0.3.1"}]
end
  1. Ensure redix_pubsub_fastlane is started before your application:
def application do
[applications: [:redix_pubsub_fastlane]]
end
  1. Also you can simply add it to your Mix.config:
config :redix_pubsub_fastlane, MyApp.PubSub.Redis,
fastlane: My.Fastlane,
host: "192.168.1.100"

Usage

Simply add it to your Supervisor stack:

supervisor(Redix.PubSub.Fastlane, [MyApp.PubSub.Redis, [host: "localhost",
port: 6397,
pool_size: 5]])

Or run it by hands:

{:ok, pubsub_server} = Redix.PubSub.Fastlane.start_link(MyApp.PubSub.Redis)

Config Options

OptionDescriptionDefault
:nameThe required name to register the PubSub processes, ie: MyApp.PubSub
:fastlaneThe name of base fastlane module, ie: My.Fastlanenone
:decoderThe decoder method for payloads, ie: &Poison.decode!/1none
:databaseThe redis-server database""
:hostThe redis-server host IP"127.0.0.1"
:portThe redis-server port6379
:passwordThe redis-server password""

Inspired by:

License

MIT