Class: OMQ::Rust::Java::Engine::RoutingStub

Inherits:
Object
  • Object
show all
Defined in:
lib/omq/rust/java/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(engine) ⇒ RoutingStub

Returns a new instance of RoutingStub.



588
589
590
591
592
# File 'lib/omq/rust/java/engine.rb', line 588

def initialize(engine)
  @engine            = engine
  @pending_subscribe = []
  @pending_join      = []
end

Instance Method Details

#join(group) ⇒ Object



615
616
617
618
619
620
621
622
# File 'lib/omq/rust/java/engine.rb', line 615

def join(group)
  native = @engine.instance_variable_get(:@native)
  if @engine.instance_variable_get(:@materialized)
    native.join(group.b.to_java_bytes)
  else
    @pending_join << group.b
  end
end

#leave(group) ⇒ Object



625
626
627
# File 'lib/omq/rust/java/engine.rb', line 625

def leave(group)
  @engine.instance_variable_get(:@native).leave(group.b.to_java_bytes)
end

#replay_pending(native) ⇒ Object



630
631
632
633
634
635
# File 'lib/omq/rust/java/engine.rb', line 630

def replay_pending(native)
  @pending_subscribe.each { |prefix| native.subscribe(prefix.to_java_bytes) }
  @pending_subscribe.clear
  @pending_join.each { |group| native.join(group.to_java_bytes) }
  @pending_join.clear
end

#subscribe(prefix) ⇒ Object



600
601
602
603
604
605
606
607
# File 'lib/omq/rust/java/engine.rb', line 600

def subscribe(prefix)
  native = @engine.instance_variable_get(:@native)
  if @engine.instance_variable_get(:@materialized)
    native.subscribe(prefix.b.to_java_bytes)
  else
    @pending_subscribe << prefix.b
  end
end

#subscriber_joinedObject



595
596
597
# File 'lib/omq/rust/java/engine.rb', line 595

def subscriber_joined
  @engine.subscriber_joined
end

#unsubscribe(prefix) ⇒ Object



610
611
612
# File 'lib/omq/rust/java/engine.rb', line 610

def unsubscribe(prefix)
  @engine.instance_variable_get(:@native).unsubscribe(prefix.b.to_java_bytes)
end