Class: Hoodoo::Services::Discovery::ForAMQP

Inherits:
Object
  • Object
show all
Defined in:
lib/hoodoo/services/discovery/results/for_amqp.rb

Overview

Describe a resource endpoint location in a way that allows it to be contacted over AMQP (e.g. via Alchemy).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, version:) ⇒ ForAMQP

Create an instance with named parameters as follows:

resource

See #resource.

version

See #version.



39
40
41
42
43
44
45
46
47
48
# File 'lib/hoodoo/services/discovery/results/for_amqp.rb', line 39

def initialize( resource:, version: )

  @resource     = resource.to_sym
  @version      = version.to_i
  @routing_path = Hoodoo::Services::Middleware.de_facto_path_for(
    resource,
    version
  )

end

Instance Attribute Details

#resourceObject

The resource name described, as a Symbol (e.g. :Purchase).



22
23
24
# File 'lib/hoodoo/services/discovery/results/for_amqp.rb', line 22

def resource
  @resource
end

#routing_pathObject (readonly)

Path at which the resource is expected to be found on the queue (routing via Topic Exchange and Alchemy Flux’s translations of paths to keys).



32
33
34
# File 'lib/hoodoo/services/discovery/results/for_amqp.rb', line 32

def routing_path
  @routing_path
end

#versionObject

Resource endpoint version, as an Integer (e.g. 2).



26
27
28
# File 'lib/hoodoo/services/discovery/results/for_amqp.rb', line 26

def version
  @version
end