Class: Moleculer::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/moleculer/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(broker:, action:, params:, meta:, parent_id: nil, level: 1, timeout:, id: nil) ⇒ Context

Returns a new instance of Context.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/moleculer/context.rb', line 11

def initialize(broker:, action:, params:, meta:, parent_id: nil, level: 1, timeout:, id: nil)
  @id         = id ? id : SecureRandom.uuid
  @broker     = broker
  @action     = action
  @request_id = SecureRandom.uuid
  @parent_id  = parent_id
  @params     = params
  @meta       = meta
  @level      = level
  @timeout    = timeout
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def action
  @action
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def id
  @id
end

#levelObject (readonly)

Returns the value of attribute level.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def level
  @level
end

#metaObject (readonly)

Returns the value of attribute meta.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def meta
  @meta
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def params
  @params
end

#request_idObject (readonly)

Returns the value of attribute request_id.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def request_id
  @request_id
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



3
4
5
# File 'lib/moleculer/context.rb', line 3

def timeout
  @timeout
end