Share this page

# LrKafkaProducer.closeProducer

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

`public static void closeProducer()`

`public static void closeProducer(Duration timeout)`

## Arguments

Name | Description
--- | ---
timeout | Maximum duration to wait for incomplete requests to finish

## Return values

This function does not return any values.

## General information

This function closes the current producer either immediately or after the duration of the timeout (to allow time to finish incomplete requests). The Vuser cannot use the KakfaProducer instance after this function is called.

To ensure that the KafkaProducer 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 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: