Module: CarrotRpc

Extended by:
ActiveSupport::Autoload
Defined in:
lib/carrot_rpc.rb,
lib/carrot_rpc/version.rb

Overview

An opinionated approach to doing Remote Procedure Call (RPC) with RabbitMQ and the bunny gem. CarrotRpc serves as a way to streamline the RPC workflow so developers can focus on the implementation and not the plumbing when working with RabbitMQ.

Defined Under Namespace

Modules: CLI, ClientActions, ClientServer, Exception, Format, HashExtensions, Reply, Scrub Classes: Configuration, Error, RpcClient, RpcServer, ServerRunner, TaggedLog

Constant Summary collapse

VERSION =
"1.2.1".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



40
41
42
# File 'lib/carrot_rpc.rb', line 40

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



49
50
51
# File 'lib/carrot_rpc.rb', line 49

def self.configure
  yield configuration
end

.connectBunny::Session

Attempts to start a connection to the existing Bunny object.

Returns:

  • (Bunny::Session)


55
56
57
58
# File 'lib/carrot_rpc.rb', line 55

def self.connect
  bunny = configuration.bunny
  bunny.start unless bunny.open?
end

.resetObject

Resets the configuration back to a new instance. Should only be used in testing.



45
46
47
# File 'lib/carrot_rpc.rb', line 45

def self.reset
  @configuration = Configuration.new
end