Module: Emque::Producing::Message::ClassMethods

Defined in:
lib/emque/producing/message/message.rb

Instance Method Summary collapse

Instance Method Details

#ignored_exceptions(*ignored_exceptions) ⇒ Object



43
44
45
# File 'lib/emque/producing/message/message.rb', line 43

def ignored_exceptions(*ignored_exceptions)
  @ignored_exceptions = ignored_exceptions
end

#message_type(name) ⇒ Object



19
20
21
# File 'lib/emque/producing/message/message.rb', line 19

def message_type(name)
  @message_type = name
end

#middlewareObject



23
24
25
# File 'lib/emque/producing/message/message.rb', line 23

def middleware
  @middleware || []
end

#private_attribute(name, coercion = nil, opts = {}) ⇒ Object



51
52
53
54
55
# File 'lib/emque/producing/message/message.rb', line 51

def private_attribute(name, coercion=nil, opts={})
  @private_attrs ||= []
  @private_attrs << name
  attribute(name, coercion, opts)
end

#private_attrsObject



57
58
59
# File 'lib/emque/producing/message/message.rb', line 57

def private_attrs
  Array(@private_attrs)
end

#raise_on_failure(name) ⇒ Object



31
32
33
# File 'lib/emque/producing/message/message.rb', line 31

def raise_on_failure(name)
  @raise_on_failure = name
end

#read_ignored_exceptionsObject



47
48
49
# File 'lib/emque/producing/message/message.rb', line 47

def read_ignored_exceptions
  (Array(@ignored_exceptions) + Emque::Producing.configuration.ignored_exceptions).uniq
end

#read_message_typeObject



27
28
29
# File 'lib/emque/producing/message/message.rb', line 27

def read_message_type
  @message_type
end

#read_raise_on_failureObject



35
36
37
38
39
40
41
# File 'lib/emque/producing/message/message.rb', line 35

def read_raise_on_failure
  if @raise_on_failure.nil?
    true
  else
    @raise_on_failure
  end
end

#read_topicObject



15
16
17
# File 'lib/emque/producing/message/message.rb', line 15

def read_topic
  @topic
end

#topic(name) ⇒ Object



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

def topic(name)
  @topic = name
end

#use(callable) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/emque/producing/message/message.rb', line 61

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 ||= []
  @middleware << callable
end