Class: MessageDriver::Message::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/message_driver/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx, destination, body, headers, properties, raw_body = nil) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
15
# File 'lib/message_driver/message.rb', line 8

def initialize(ctx, destination, body, headers, properties, raw_body = nil)
  @ctx = ctx
  @destination = destination
  @body = body
  @headers = headers
  @properties = properties
  @raw_body = raw_body.nil? ? body : raw_body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def body
  @body
end

#ctxObject (readonly)

Returns the value of attribute ctx.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def ctx
  @ctx
end

#destinationObject (readonly)

Returns the value of attribute destination.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def destination
  @destination
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def headers
  @headers
end

#propertiesObject (readonly)

Returns the value of attribute properties.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def properties
  @properties
end

#raw_bodyObject (readonly)

Returns the value of attribute raw_body.



6
7
8
# File 'lib/message_driver/message.rb', line 6

def raw_body
  @raw_body
end

Instance Method Details

#ack(options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/message_driver/message.rb', line 17

def ack(options = {})
  if ctx.supports_client_acks?
    ctx.ack_message(self, options)
  else
    logger.debug('this adapter does not support client acks')
  end
end

#nack(options = {}) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/message_driver/message.rb', line 25

def nack(options = {})
  if ctx.supports_client_acks?
    ctx.nack_message(self, options)
  else
    logger.debug('this adapter does not support client acks')
  end
end