Class: TestKafka::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/test_kafka/cluster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kafka_path, tmp_dir, kafka_port, zk_port) ⇒ Cluster

Returns a new instance of Cluster.



6
7
8
9
# File 'lib/test_kafka/cluster.rb', line 6

def initialize(kafka_path, tmp_dir, kafka_port, zk_port)
  @zookeeper = Zookeeper.new(kafka_path, tmp_dir, zk_port)
  @broker = Broker.new(kafka_path, tmp_dir, kafka_port, zk_port)
end

Instance Attribute Details

#brokerObject (readonly)

Returns the value of attribute broker.



11
12
13
# File 'lib/test_kafka/cluster.rb', line 11

def broker
  @broker
end

#zookeeperObject (readonly)

Returns the value of attribute zookeeper.



11
12
13
# File 'lib/test_kafka/cluster.rb', line 11

def zookeeper
  @zookeeper
end

Instance Method Details

#startObject



13
14
15
16
17
18
# File 'lib/test_kafka/cluster.rb', line 13

def start
  @zookeeper.start
  @broker.start

  self
end

#stopObject



20
21
22
23
24
25
# File 'lib/test_kafka/cluster.rb', line 20

def stop
  @zookeeper.stop
  @broker.stop

  self
end

#with_interruption(&block) ⇒ Object



27
28
29
# File 'lib/test_kafka/cluster.rb', line 27

def with_interruption(&block)
  @broker.with_interruption(&block)
end