Module: Jackhammer

Defined in:
lib/jackhammer.rb,
lib/jackhammer/cli.rb,
lib/jackhammer/log.rb,
lib/jackhammer/queue.rb,
lib/jackhammer/topic.rb,
lib/jackhammer/server.rb,
lib/jackhammer/version.rb,
lib/jackhammer/rake_task.rb,
lib/jackhammer/queue_name.rb,
lib/jackhammer/configuration.rb,
lib/jackhammer/topic_manager.rb,
lib/jackhammer/message_receiver.rb,
lib/jackhammer/middleware_collection.rb,
lib/jackhammer/configuration_validator.rb

Defined Under Namespace

Classes: CLI, Configuration, ConfigurationValidator, Log, MessageReceiver, MiddlewareCollection, Queue, QueueName, RakeTask, Server, Topic, TopicManager

Constant Summary collapse

VERSION =
'1.5.1'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



19
20
21
# File 'lib/jackhammer.rb', line 19

def configuration
  @configuration
end

.connectionObject



27
28
29
30
31
32
# File 'lib/jackhammer.rb', line 27

def connection
  @connection ||= Bunny.new(
    Jackhammer.configuration.connection_url,
    Jackhammer.configuration.connection_options
  ).start
end

Class Method Details

.channelObject



34
35
36
# File 'lib/jackhammer.rb', line 34

def channel
  @channel ||= connection.create_channel
end

.client_middlewareObject



51
52
53
# File 'lib/jackhammer.rb', line 51

def client_middleware
  configuration.client_middleware
end

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

Yields:



22
23
24
25
# File 'lib/jackhammer.rb', line 22

def configure
  @configuration = Configuration.instance
  yield @configuration
end

.publish_options(options = {}, time = Time.now.utc) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/jackhammer.rb', line 42

def publish_options(options = {}, time = Time.now.utc)
  configuration.publish_options.dup.merge(options).tap do |opts|
    opts[:timestamp] = time.to_i
    opts[:app_id] ||= configuration.app_name
    opts[:headers] ||= {}
    opts[:headers][:time] ||= time.iso8601
  end
end

.server_middlewareObject



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

def server_middleware
  configuration.server_middleware
end

.topicsObject



38
39
40
# File 'lib/jackhammer.rb', line 38

def topics
  @topics ||= TopicManager.topics
end