Share this page

# LrKafkaConsumer.subscribe

Calls the subscribe method on the KafkaConsumer initialized for the Vuser.

`public static void subscribe(Pattern pattern, ConsumerRebalanceListener listener)`

`public static void subscribe(Pattern pattern)`

`public static void subscribe(Collection<String> topics)`

`public static void subscribe(Collection<String> topics, ConsumerRebalanceListener listener)`

## Arguments

Name | Description
--- | ---
pattern | Pattern for matching the topics that the consumer listens for
listener | Non-null listener instance to receive notifications on partition assignment/revocation for the subscribed topics
topics | Collection of topics to listen to

## Return values

This function does not return any values.

## General information

This function allows you to subscribe to a pattern, topic, or list of topics found on the Kafka broker.

For more information about this function, see the Apache Kafka documentation.

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: