Record Class ConfiguredConsumerProducerApp<T extends ConsumerProducerApp>
java.lang.Object
java.lang.Record
com.bakdata.kafka.consumerproducer.ConfiguredConsumerProducerApp<T>
- Type Parameters:
T- type ofConsumerProducerApp
- All Implemented Interfaces:
ConfiguredApp<ExecutableConsumerProducerApp<T>>,AutoCloseable
public record ConfiguredConsumerProducerApp<T extends ConsumerProducerApp>(T extends ConsumerProducerApp app, @NonNull ConsumerProducerAppConfiguration configuration)
extends Record
implements ConfiguredApp<ExecutableConsumerProducerApp<T>>
A
ConsumerProducerApp with a corresponding ConsumerProducerAppConfiguration-
Constructor Summary
ConstructorsConstructorDescriptionConfiguredConsumerProducerApp(T app, @NonNull ConsumerProducerAppConfiguration configuration) Creates an instance of aConfiguredConsumerProducerApprecord class. -
Method Summary
Modifier and TypeMethodDescriptionapp()Returns the value of theapprecord component.voidclose()@NonNull ConsumerProducerAppConfigurationReturns the value of theconfigurationrecord component.final booleanIndicates whether some other object is "equal to" this one.getKafkaProperties(RuntimeConfiguration runtimeConfiguration) This method creates the configuration to run aConsumerProducerApp.Get topic configurationGet unique group identifier ofConsumerProducerAppfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.withRuntimeConfiguration(RuntimeConfiguration runtimeConfiguration) Create anExecutableConsumerProducerAppusing the providedRuntimeConfiguration
-
Constructor Details
-
ConfiguredConsumerProducerApp
public ConfiguredConsumerProducerApp(@NonNull T app, @NonNull @NonNull ConsumerProducerAppConfiguration configuration) Creates an instance of aConfiguredConsumerProducerApprecord class.- Parameters:
app- the value for theapprecord componentconfiguration- the value for theconfigurationrecord component
-
-
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:
-
getUniqueAppId
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>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
app
Returns the value of theapprecord component.- Returns:
- the value of the
apprecord component
-
configuration
Returns the value of theconfigurationrecord component.- Returns:
- the value of the
configurationrecord component
-