Share this page

# LrKafkaConsumer.closeConsumer

Calls the close method on KafkaConsumer initialized for the Vuser and uninitializes it.

`public static void closeConsumer()`

`public static void closeConsumer(long timeout, TimeUnit timeUnit)`

`public static void closeProducer(Duration timeout)`

## Arguments

Name | Description
--- | ---
timeout | Custom timeout for cleanup, as a number. The unit of time is specified in timeUnit.
timeUnit | Unit of time specified for the timeout
timeout (Duration) | The timeout limit for the poll call as a Duration object

## Return values

This function does not return any values.

## General information

This function closes the current consumer on the Vuser after waiting for the duration of the timeout (to allow time for any necessary cleanup). By default, the timeout is set to 30 seconds. The Vuser cannot use the KakfaConsumer instance after this function is called.

To ensure that the KafkaConsumer is not needed after this function call, it is recommended to call the function in the End method of the Vuser script. For details, see Manually create and edit a Kafka script in the VuGen help center.

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