Module: Vx::Lib::Consumer

Extended by:
Consumer
Included in:
Consumer
Defined in:
lib/vx/lib/consumer.rb,
lib/vx/lib/consumer/ack.rb,
lib/vx/lib/consumer/rpc.rb,
lib/vx/lib/consumer/error.rb,
lib/vx/lib/consumer/params.rb,
lib/vx/lib/consumer/publish.rb,
lib/vx/lib/consumer/session.rb,
lib/vx/lib/consumer/testing.rb,
lib/vx/lib/consumer/version.rb,
lib/vx/lib/consumer/subscribe.rb,
lib/vx/lib/consumer/instrument.rb,
lib/vx/lib/consumer/serializer.rb,
lib/vx/lib/consumer/subscriber.rb,
lib/vx/lib/consumer/configuration.rb

Defined Under Namespace

Modules: Ack, ClassMethods, Instrument, Publish, Rpc, Subscribe, Testing Classes: Configuration, ConnectionDoesNotExistError, ModelIsNotdefined, Params, Serializer, Session, Subscriber

Constant Summary collapse

VERSION =
"0.2.1"
@@session =
Session.new
@@configuration =
Configuration.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_channelObject

Returns the value of attribute _channel.



24
25
26
# File 'lib/vx/lib/consumer.rb', line 24

def _channel
  @_channel
end

#delivery_infoObject

Returns the value of attribute delivery_info.



23
24
25
# File 'lib/vx/lib/consumer.rb', line 23

def delivery_info
  @delivery_info
end

#propertiesObject

Returns the value of attribute properties.



22
23
24
# File 'lib/vx/lib/consumer.rb', line 22

def properties
  @properties
end

Class Method Details

.included(base) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/vx/lib/consumer.rb', line 26

def self.included(base)
  base.extend ClassMethods
  base.extend Instrument
  base.extend Publish
  base.extend Subscribe
  base.extend Rpc
  base.send :include, Ack
  base.send :include, Instrument
end

Instance Method Details

#configurationObject



121
122
123
# File 'lib/vx/lib/consumer.rb', line 121

def configuration
  @@configuration
end

#configure {|configuration| ... } ⇒ Object

Yields:



117
118
119
# File 'lib/vx/lib/consumer.rb', line 117

def configure
  yield configuration
end

#exception_handler(e, env) ⇒ Object



129
130
131
132
133
134
# File 'lib/vx/lib/consumer.rb', line 129

def exception_handler(e, env)
  unless env.is_a?(Hash)
    env = {env: env}
  end
  configuration.on_error.call(e, env)
end

#live?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/vx/lib/consumer.rb', line 109

def live?
  session.live?
end

#sessionObject



125
126
127
# File 'lib/vx/lib/consumer.rb', line 125

def session
  @@session
end

#shutdownObject



105
106
107
# File 'lib/vx/lib/consumer.rb', line 105

def shutdown
  session.shutdown
end

#wait_shutdown(timeout = nil) ⇒ Object



113
114
115
# File 'lib/vx/lib/consumer.rb', line 113

def wait_shutdown(timeout = nil)
  session.wait_shutdown(timeout)
end