Class: Bunny::RecordedQueue

Inherits:
RecordedNamedEntity show all
Defined in:
lib/bunny/topology_registry.rb

Overview

Represents an exchange declaration intent that can be repeated.

Server-named queues will acquire a new server-generated name.

Constant Summary collapse

EMPTY_STRING =
"".freeze

Instance Attribute Summary collapse

Attributes inherited from RecordedNamedEntity

#name

Attributes inherited from RecordedEntity

#channel

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ch, name) ⇒ RecordedQueue

Returns a new instance of RecordedQueue.

Parameters:



562
563
564
565
566
567
568
569
570
# File 'lib/bunny/topology_registry.rb', line 562

def initialize(ch, name)
  super ch, name

  @durable = true
  @auto_delete = false
  @exclusive = false
  @server_named = false
  @arguments = nil
end

Instance Attribute Details

#argumentsHash (readonly)

Returns:

  • (Hash)


558
559
560
# File 'lib/bunny/topology_registry.rb', line 558

def arguments
  @arguments
end

#auto_deleteBoolean (readonly)

Returns:

  • (Boolean)


556
557
558
# File 'lib/bunny/topology_registry.rb', line 556

def auto_delete
  @auto_delete
end

#durableBoolean (readonly)

Returns:

  • (Boolean)


556
557
558
# File 'lib/bunny/topology_registry.rb', line 556

def durable
  @durable
end

#exclusiveBoolean (readonly)

Returns:

  • (Boolean)


556
557
558
# File 'lib/bunny/topology_registry.rb', line 556

def exclusive
  @exclusive
end

Class Method Details

.from(q) ⇒ Object

Parameters:



651
652
653
654
655
656
657
658
# File 'lib/bunny/topology_registry.rb', line 651

def self.from(q)
  new(q.channel, q.name)
    .with_server_named(q.server_named?)
    .with_durable(q.durable?)
    .with_auto_delete(q.auto_delete?)
    .with_exclusive(q.exclusive?)
    .with_arguments(q.arguments)
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


636
637
638
639
640
641
642
643
644
# File 'lib/bunny/topology_registry.rb', line 636

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.exclusive == self.exclusive &&
    other.arguments == self.arguments
end

#auto_delete?Boolean

Returns:

  • (Boolean)


590
591
592
# File 'lib/bunny/topology_registry.rb', line 590

def auto_delete?
  @auto_delete
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


631
632
633
# File 'lib/bunny/topology_registry.rb', line 631

def eql?(other)
  self == other
end

#exclusive?Boolean

Returns:

  • (Boolean)


600
601
602
# File 'lib/bunny/topology_registry.rb', line 600

def exclusive?
  @exclusive
end

#hashObject



646
647
648
# File 'lib/bunny/topology_registry.rb', line 646

def hash
  [self.class, self.channel, @name, @durable].hash
end

#name_to_use_for_recoveryString

Returns:

  • (String)


622
623
624
625
626
627
628
# File 'lib/bunny/topology_registry.rb', line 622

def name_to_use_for_recovery
  if server_named?
    EMPTY_STRING
  else
    self.name
  end
end

#server_named?Boolean

Returns:

  • (Boolean)


611
612
613
# File 'lib/bunny/topology_registry.rb', line 611

def server_named?
  !!@server_named
end

#update_name_to(value) ⇒ Object

Parameters:

  • value (String)


573
574
575
576
# File 'lib/bunny/topology_registry.rb', line 573

def update_name_to(value)
  @name = value
  self
end

#with_arguments(value) ⇒ Object

Parameters:

  • value (Hash)


616
617
618
619
# File 'lib/bunny/topology_registry.rb', line 616

def with_arguments(value)
  @arguments = value
  self
end

#with_auto_delete(value) ⇒ Object

Parameters:

  • value (Boolean)


585
586
587
588
# File 'lib/bunny/topology_registry.rb', line 585

def with_auto_delete(value)
  @auto_delete = value
  self
end

#with_durable(value) ⇒ Object

Parameters:

  • value (Boolean)


579
580
581
582
# File 'lib/bunny/topology_registry.rb', line 579

def with_durable(value)
  @durable = value
  self
end

#with_exclusive(value) ⇒ Object

Parameters:

  • value (Boolean)


595
596
597
598
# File 'lib/bunny/topology_registry.rb', line 595

def with_exclusive(value)
  @exclusive = value
  self
end

#with_server_named(value) ⇒ Object

Parameters:

  • value (Boolean)


605
606
607
608
# File 'lib/bunny/topology_registry.rb', line 605

def with_server_named(value)
  @server_named = value
  self
end