Class: MagicPipe::Client
- Inherits:
-
Object
- Object
- MagicPipe::Client
- Defined in:
- lib/magic_pipe/client.rb
Instance Attribute Summary collapse
-
#codec ⇒ Object
readonly
Returns the value of attribute codec.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#loader ⇒ Object
readonly
Returns the value of attribute loader.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #send_data(object:, topic:, wrapper: nil, time: Time.now.utc) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/magic_pipe/client.rb', line 3 def initialize(config) @config = config @name = config.client_name @metrics = Metrics.new(@config) @transport = build_transport @codec = Codecs.lookup(config.codec) @sender = Senders.lookup(config.sender) @loader = Loaders.lookup(config.loader) end |
Instance Attribute Details
#codec ⇒ Object (readonly)
Returns the value of attribute codec.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def codec @codec end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def config @config end |
#loader ⇒ Object (readonly)
Returns the value of attribute loader.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def loader @loader end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def metrics @metrics end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def name @name end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def sender @sender end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
17 18 19 |
# File 'lib/magic_pipe/client.rb', line 17 def transport @transport end |
Instance Method Details
#send_data(object:, topic:, wrapper: nil, time: Time.now.utc) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/magic_pipe/client.rb', line 19 def send_data(object:, topic:, wrapper: nil, time: Time.now.utc) sender.new( object, topic, wrapper, time, codec, transport, @config, @metrics ).call true end |