Class ConfiguredConsumerProducerApp<T extends ConsumerProducerApp>
java.lang.Object
com.bakdata.kafka.consumerproducer.ConfiguredConsumerProducerApp<T>
- Type Parameters:
T- type ofConsumerProducerApp
- All Implemented Interfaces:
ConfiguredApp<ExecutableConsumerProducerApp<T>>,AutoCloseable
public class ConfiguredConsumerProducerApp<T extends ConsumerProducerApp>
extends Object
implements ConfiguredApp<ExecutableConsumerProducerApp<T>>
A
ConsumerProducerApp with a corresponding ConsumerProducerAppConfiguration-
Constructor Summary
ConstructorsConstructorDescriptionConfiguredConsumerProducerApp(T app, @NonNull ConsumerProducerAppConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getApp()getKafkaProperties(RuntimeConfiguration runtimeConfiguration) This method creates the configuration to run aConsumerProducerApp.Get topic configurationGet unique group identifier ofConsumerProducerAppwithRuntimeConfiguration(RuntimeConfiguration runtimeConfiguration) Create anExecutableConsumerProducerAppusing the providedRuntimeConfiguration
-
Constructor Details
-
ConfiguredConsumerProducerApp
public ConfiguredConsumerProducerApp(@NonNull T app, @NonNull @NonNull ConsumerProducerAppConfiguration configuration)
-
-
Method Details
-
getKafkaProperties
This method creates the configuration to run a
Configuration is created in the following orderConsumerProducerApp.- Producer:
max.in.flight.requests.per.connection=1 acks=all compression.type=gzip
- Consumer:
auto.offset.reset=earliest
-
Configs provided by
App.createKafkaProperties() -
Configs provided via environment variables (see
EnvironmentKafkaConfigParser.parseVariables(Map)) -
Configs provided by
RuntimeConfiguration.createKafkaProperties() -
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIGandProducerConfig.VALUE_SERIALIZER_CLASS_CONFIGandConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIGandConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIGis configured usingConsumerProducerApp.defaultSerializationConfig()
- Parameters:
runtimeConfiguration- configuration to run app with- Returns:
- Kafka configuration
- Producer:
-
getUniqueGroupId
Get unique group identifier ofConsumerProducerApp- Returns:
- unique group identifier
- Throws:
IllegalArgumentException- if unique group identifier ofConsumerProducerAppis different from provided group identifier inConsumerProducerAppConfiguration- See Also:
-
withRuntimeConfiguration
public ExecutableConsumerProducerApp<T> withRuntimeConfiguration(RuntimeConfiguration runtimeConfiguration) Create anExecutableConsumerProducerAppusing the providedRuntimeConfiguration- Specified by:
withRuntimeConfigurationin interfaceConfiguredApp<T extends ConsumerProducerApp>- Parameters:
runtimeConfiguration- configuration to run app with- Returns:
ExecutableConsumerProducerApp
-
getTopics
Get topic configuration- Returns:
- topic configuration
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConfiguredApp<T extends ConsumerProducerApp>
-
getApp
-