Class: Bunny::RecordedExchange
- Inherits:
-
RecordedNamedEntity
- Object
- RecordedEntity
- RecordedNamedEntity
- Bunny::RecordedExchange
- Defined in:
- lib/bunny/topology_registry.rb
Overview
Represents an exchange declaration intent that can be repeated.
Instance Attribute Summary collapse
- #arguments ⇒ Hash readonly
- #auto_delete ⇒ Boolean readonly
- #durable ⇒ Boolean readonly
- #type ⇒ String readonly
Attributes inherited from RecordedNamedEntity
Attributes inherited from RecordedEntity
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Integer
-
#initialize(ch, name) ⇒ RecordedExchange
constructor
A new instance of RecordedExchange.
-
#predefined? ⇒ Boolean
(also: #predeclared?)
True if this exchange is a pre-defined one (amq.direct, amq.fanout, amq.match and so on).
- #with_arguments(value) ⇒ Object
- #with_auto_delete(value) ⇒ Object
- #with_durable(value) ⇒ Object
- #with_type(value) ⇒ Object
Constructor Details
#initialize(ch, name) ⇒ RecordedExchange
Returns a new instance of RecordedExchange.
479 480 481 482 483 484 485 486 |
# File 'lib/bunny/topology_registry.rb', line 479 def initialize(ch, name) super(ch, name) @type = nil @durable = true @auto_delete = false @arguments = nil end |
Instance Attribute Details
#arguments ⇒ Hash (readonly)
475 476 477 |
# File 'lib/bunny/topology_registry.rb', line 475 def arguments @arguments end |
#auto_delete ⇒ Boolean (readonly)
473 474 475 |
# File 'lib/bunny/topology_registry.rb', line 473 def auto_delete @auto_delete end |
#durable ⇒ Boolean (readonly)
471 472 473 |
# File 'lib/bunny/topology_registry.rb', line 471 def durable @durable end |
#type ⇒ String (readonly)
469 470 471 |
# File 'lib/bunny/topology_registry.rb', line 469 def type @type end |
Class Method Details
.from(x) ⇒ Object
540 541 542 543 544 545 546 |
# File 'lib/bunny/topology_registry.rb', line 540 def self.from(x) new(x.channel, x.name) .with_type(x.type) .with_durable(x.durable?) .with_auto_delete(x.auto_delete?) .with_arguments(x.arguments) end |
Instance Method Details
#==(other) ⇒ Boolean
529 530 531 532 533 534 535 536 537 |
# File 'lib/bunny/topology_registry.rb', line 529 def ==(other) other.class == self.class && other.name == self.name && other.channel == self.channel && other.durable == self.durable && other.auto_delete == self.auto_delete && other.type == self.type && other.arguments == self.arguments end |
#eql?(other) ⇒ Boolean
524 525 526 |
# File 'lib/bunny/topology_registry.rb', line 524 def eql?(other) self == other end |
#hash ⇒ Integer
519 520 521 |
# File 'lib/bunny/topology_registry.rb', line 519 def hash [self.class, self.channel, self.name, @type, @durable, @auto_delete, @arguments].hash end |
#predefined? ⇒ Boolean Also known as: predeclared?
Returns true if this exchange is a pre-defined one (amq.direct, amq.fanout, amq.match and so on).
489 490 491 |
# File 'lib/bunny/topology_registry.rb', line 489 def predefined? (@name == AMQ::Protocol::EMPTY_STRING) || !!(@name =~ /^amq\.(direct|fanout|topic|headers|match)/i) end |
#with_arguments(value) ⇒ Object
513 514 515 516 |
# File 'lib/bunny/topology_registry.rb', line 513 def with_arguments(value) @arguments = value self end |
#with_auto_delete(value) ⇒ Object
501 502 503 504 |
# File 'lib/bunny/topology_registry.rb', line 501 def with_auto_delete(value) @auto_delete = value self end |
#with_durable(value) ⇒ Object
495 496 497 498 |
# File 'lib/bunny/topology_registry.rb', line 495 def with_durable(value) @durable = value self end |
#with_type(value) ⇒ Object
507 508 509 510 |
# File 'lib/bunny/topology_registry.rb', line 507 def with_type(value) @type = value self end |