Class: Racecar::Consumer

Inherits:
Object
  • Object
show all
Defined in:
lib/racecar/consumer.rb

Defined Under Namespace

Classes: Subscription

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.group_idObject

Returns the value of attribute group_id.



7
8
9
# File 'lib/racecar/consumer.rb', line 7

def group_id
  @group_id
end

.max_wait_timeObject

Returns the value of attribute max_wait_time.



6
7
8
# File 'lib/racecar/consumer.rb', line 6

def max_wait_time
  @max_wait_time
end

.offset_retention_timeObject

Returns the value of attribute offset_retention_time.



8
9
10
# File 'lib/racecar/consumer.rb', line 8

def offset_retention_time
  @offset_retention_time
end

Class Method Details

.subscribes_to(*topics, start_from_beginning: true, max_bytes_per_partition: 1048576) ⇒ nil

Adds one or more topic subscriptions.

Can be called multiple times in order to subscribe to more topics.

Parameters:

  • topics (String)

    one or more topics to subscribe to.

  • start_from_beginning (Boolean) (defaults to: true)

    whether to start from the beginning or the end of each partition.

  • max_bytes_per_partition (Integer) (defaults to: 1048576)

    the maximum number of bytes to fetch from each partition at a time.

Returns:

  • (nil)


24
25
26
27
28
# File 'lib/racecar/consumer.rb', line 24

def subscribes_to(*topics, start_from_beginning: true, max_bytes_per_partition: 1048576)
  topics.each do |topic|
    subscriptions << Subscription.new(topic, start_from_beginning, max_bytes_per_partition)
  end
end

.subscriptionsObject



10
11
12
# File 'lib/racecar/consumer.rb', line 10

def subscriptions
  @subscriptions ||= []
end

Instance Method Details

#configure(consumer:, producer:) ⇒ Object



31
32
33
34
# File 'lib/racecar/consumer.rb', line 31

def configure(consumer:, producer:)
  @_consumer = consumer
  @_producer = producer
end

#teardownObject



36
# File 'lib/racecar/consumer.rb', line 36

def teardown; end