Class: Drnbench::PublishSubscribe::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/drnbench/publish-subscribe/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 25

def initialize
  @start_n_subscribers  = 1000
  @n_publishings        = 1000
  @n_steps              = 10
  @timeout              = 10

  @report_progressively = true
  @output_path          = "/tmp/drnbench-pubsub-result.csv"

  @engine           = Server::EngineConfiguration.new
  @protocol_adapter = Server::ProtocolAdapterConfiguration.new
  @protocol_adapter.engine = @engine
end

Instance Attribute Details

#engineObject

Returns the value of attribute engine


22
23
24
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 22

def engine
  @engine
end

#feed_fileObject

Returns the value of attribute feed_file


22
23
24
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 22

def feed_file
  @feed_file
end

#n_publishingsObject

Returns the value of attribute n_publishings


21
22
23
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 21

def n_publishings
  @n_publishings
end

#n_stepsObject

Returns the value of attribute n_steps


21
22
23
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 21

def n_steps
  @n_steps
end

#output_pathObject

Returns the value of attribute output_path


23
24
25
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 23

def output_path
  @output_path
end

#protocol_adapterObject

Returns the value of attribute protocol_adapter


22
23
24
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 22

def protocol_adapter
  @protocol_adapter
end

#report_progressivelyObject

Returns the value of attribute report_progressively


23
24
25
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 23

def report_progressively
  @report_progressively
end

#start_n_subscribersObject

Returns the value of attribute start_n_subscribers


21
22
23
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 21

def start_n_subscribers
  @start_n_subscribers
end

#subscribe_request_fileObject

Returns the value of attribute subscribe_request_file


22
23
24
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 22

def subscribe_request_file
  @subscribe_request_file
end

#timeoutObject

Returns the value of attribute timeout


21
22
23
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 21

def timeout
  @timeout
end

Instance Method Details

#feedObject


56
57
58
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 56

def feed
  @feed ||= prepare_feed
end

#new_feedObject


60
61
62
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 60

def new_feed
  Marshal.load(Marshal.dump(feed))
end

#new_subscribe_requestObject


52
53
54
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 52

def new_subscribe_request
  Marshal.load(Marshal.dump(subscribe_request))
end

#subscribe_requestObject


48
49
50
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 48

def subscribe_request
  @subscribe_request ||= prepare_subscribe_request
end

#validateObject


39
40
41
42
43
44
45
46
# File 'lib/drnbench/publish-subscribe/configuration.rb', line 39

def validate
  if @subscribe_request_file.nil?
    raise ArgumentError.new("You must specify a JSON file for a message pattern to subscribe.")
  end
  if @feed_file.nil?
    raise ArgumentError.new("You must specify a JSON file for a message pattern to feed.")
  end
end