Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
New Leaders style message bus.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/thincloud
test
.document
.gitignore
.travis.yml
.yardopts
ChangeLog.md
Gemfile
LICENSE.txt
README.md
Rakefile
thincloud-messagebus.gemspec

README.md

Build Status Code
Climate

thincloud-messagebus

Description

A thin wrapper around the event_bus gem to provide a simple interface for Thincloud applications. Still a work in progress.

Features

Examples

Add Messagebus

require 'thincloud/messagebus'

# Mix it into your application wherever you want

module MyApplication
  extend Thincloud::Messagebus
end

# Now you have `publish` and `subscribe` methods
MyApplication.publish()

MyApplication.subscribe()

Using it with Rails

Mix it in to your application as above and optionally bring along ActiveRecord goodness.

require "thincloud/messagebus/active_record"

class Foo < ActiveRecord::Base
  include Thincloud::Messagebus::ActiveRecord
end

#### Now you can subscribe to the model
MyApplication.subscribe_to_model()

Example of wiring up subscribers

# Load all subscribers since the subscriber directory is not auto-loaded.
#
# We don't want to auto-load the directory because we don't have
# class/module/filename parity in there.

Dir["#{Rails.root}/app/subscribers/*.rb"].each do |file|
  require_dependency file
end

Requirements

  • event_bus gem

Install

$ gem install thincloud-messagebus

Copyright

Copyright (c) 2014 New Leaders

See LICENSE.txt for details.

Something went wrong with that request. Please try again.