Class: Stapfen::Client::Stomp

Inherits:
Stomp::Client
  • Object
show all
Defined in:
lib/stapfen/client/stomp.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Stomp

Returns a new instance of Stomp.



7
8
9
10
11
12
# File 'lib/stapfen/client/stomp.rb', line 7

def initialize(config)
  # Perform a deep-copy of the configuration since +Stomp::Client+ will
  # mutate/mess up the configuration +Hash+ passed in here, see:
  #   <https://github.com/stompgem/stomp/issues/80>
  super(Marshal.load(Marshal.dump(config)))
end

Instance Method Details

#can_unreceive?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/stapfen/client/stomp.rb', line 18

def can_unreceive?
  true
end

#connect(*args) ⇒ Object



14
15
16
# File 'lib/stapfen/client/stomp.rb', line 14

def connect(*args)
  # No-op, since Stomp::Client will connect on instantiation
end

#runloopObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/stapfen/client/stomp.rb', line 22

def runloop
  # Performing this join/runningloop to make sure that we don't
  # experience potential deadlocks between signal handlers who might
  # close the connection, and an infinite Client#join call
  #
  # Instead of using client#open? we use #running which will still be
  # true even if the client is currently in an exponential reconnect loop
  while self.running do
    self.join(1)
  end
end