Package com.bakdata.kafka.consumer
Record Class ConfiguredConsumerApp<T extends ConsumerApp>
java.lang.Object
java.lang.Record
com.bakdata.kafka.consumer.ConfiguredConsumerApp<T>
- Type Parameters:
T- type ofConsumerApp
- All Implemented Interfaces:
ConfiguredApp<ExecutableConsumerApp<T>>,AutoCloseable
public record ConfiguredConsumerApp<T extends ConsumerApp>(T extends ConsumerApp app, @NonNull ConsumerAppConfiguration configuration)
extends Record
implements ConfiguredApp<ExecutableConsumerApp<T>>
A
ConsumerApp with a corresponding ConsumerAppConfiguration-
Constructor Summary
ConstructorsConstructorDescriptionConfiguredConsumerApp(T app, @NonNull ConsumerAppConfiguration configuration) Creates an instance of aConfiguredConsumerApprecord class. -
Method Summary
Modifier and TypeMethodDescriptionapp()Returns the value of theapprecord component.voidclose()@NonNull ConsumerAppConfigurationReturns 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 aConsumerApp.Get topic configurationGet unique group identifier ofConsumerAppfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.withRuntimeConfiguration(RuntimeConfiguration runtimeConfiguration) Create anExecutableConsumerAppusing the providedRuntimeConfiguration
-
Constructor Details
-
ConfiguredConsumerApp
public ConfiguredConsumerApp(@NonNull T app, @NonNull @NonNull ConsumerAppConfiguration configuration) Creates an instance of aConfiguredConsumerApprecord class.- Parameters:
app- the value for theapprecord componentconfiguration- the value for theconfigurationrecord component
-
-
Method Details
-
createBaseConfig
-
getKafkaProperties
This method creates the configuration to run a
Configuration is created in the following orderConsumerApp.-
Offset management:
auto.offset.reset=earliest enable.auto.commit=false
-
Configs provided by
App.createKafkaProperties() -
Configs provided via environment variables (see
EnvironmentKafkaConfigParser.parseVariables(Map)) -
Configs provided by
RuntimeConfiguration.createKafkaProperties() -
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIGandConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIGis configured usingConsumerApp.defaultSerializationConfig()
- Parameters:
runtimeConfiguration- configuration to run app with- Returns:
- Kafka configuration
-
Offset management:
-
getUniqueGroupId
Get unique group identifier ofConsumerApp- Returns:
- unique group identifier
- Throws:
IllegalArgumentException- if unique group identifier ofConsumerAppis different from provided group identifier inConsumerAppConfiguration- See Also:
-
withRuntimeConfiguration
Create anExecutableConsumerAppusing the providedRuntimeConfiguration- Specified by:
withRuntimeConfigurationin interfaceConfiguredApp<T extends ConsumerApp>- Parameters:
runtimeConfiguration- configuration to run app with- Returns:
ExecutableConsumerApp
-
getTopics
Get topic configuration- Returns:
- topic configuration
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConfiguredApp<T extends ConsumerApp>
-
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
-