Class: Emque::Producing::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/emque/producing/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/emque/producing/configuration.rb', line 15

def initialize
  @app_name = ""
  @publishing_adapter = :rabbitmq
  @error_handlers = []
  @log_publish_message = false
  @publish_messages = true
  @rabbitmq_options = {
    :url => "amqp://guest:guest@localhost:5672"
  }
  @ignored_exceptions = [Emque::Producing::Message::MessagesNotSentError]
  @middleware = []
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



6
7
8
# File 'lib/emque/producing/configuration.rb', line 6

def app_name
  @app_name
end

#error_handlersObject

Returns the value of attribute error_handlers.



8
9
10
# File 'lib/emque/producing/configuration.rb', line 8

def error_handlers
  @error_handlers
end

#ignored_exceptionsObject

Returns the value of attribute ignored_exceptions.



12
13
14
# File 'lib/emque/producing/configuration.rb', line 12

def ignored_exceptions
  @ignored_exceptions
end

#log_publish_messageObject

Returns the value of attribute log_publish_message.



9
10
11
# File 'lib/emque/producing/configuration.rb', line 9

def log_publish_message
  @log_publish_message
end

#middlewareObject (readonly)

Returns the value of attribute middleware.



13
14
15
# File 'lib/emque/producing/configuration.rb', line 13

def middleware
  @middleware
end

#publish_messagesObject

Returns the value of attribute publish_messages.



10
11
12
# File 'lib/emque/producing/configuration.rb', line 10

def publish_messages
  @publish_messages
end

#publishing_adapterObject

Returns the value of attribute publishing_adapter.



7
8
9
# File 'lib/emque/producing/configuration.rb', line 7

def publishing_adapter
  @publishing_adapter
end

#rabbitmq_optionsObject (readonly)

Returns the value of attribute rabbitmq_options.



11
12
13
# File 'lib/emque/producing/configuration.rb', line 11

def rabbitmq_options
  @rabbitmq_options
end

Instance Method Details

#use(callable) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/emque/producing/configuration.rb', line 28

def use(callable)
  unless callable.respond_to?(:call) and callable.arity == 1
    raise(
      ConfigurationError,
      "#{self.class.name}#use must receive a callable object with an " +
      "arity of one."
    )
  end

  @middleware << callable
end