Class MockConsumerFactory<K,V> 
java.lang.Object
org.springframework.kafka.mock.MockConsumerFactory<K,V> 
- Type Parameters:
- K- the key type.
- V- the value type.
- All Implemented Interfaces:
- ConsumerFactory<K,- V> 
Support the use of 
MockConsumer in tests.- Since:
- 3.0.7
- Author:
- Gary Russell
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.kafka.core.ConsumerFactoryConsumerFactory.Listener<K,V> 
- 
Constructor SummaryConstructorsConstructorDescriptionMockConsumerFactory(Supplier<org.apache.kafka.clients.consumer.MockConsumer<K, V>> consumerProvider) Create an instance with the supplied consumer provider.
- 
Method SummaryModifier and TypeMethodDescriptioncreateConsumer(String groupId, String clientIdPrefix, String clientIdSuffix) Create a consumer with an explicit group id; in addition, the client id suffix is appended to the clientIdPrefix which overrides theclient.idproperty, if present.createConsumer(String groupId, String clientIdPrefix, String clientIdSuffix, Properties properties) Create a consumer with an explicit group id; in addition, the client id suffix is appended to the clientIdPrefix which overrides theclient.idproperty, if present.Return an unmodifiable reference to the configuration map for this factory.booleanReturn true if consumers created by this factory use auto commit.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.kafka.core.ConsumerFactoryaddListener, addListener, addPostProcessor, createConsumer, createConsumer, createConsumer, getKeyDeserializer, getListeners, getPostProcessors, getValueDeserializer, removeConfig, removeListener, removePostProcessor, updateConfigs
- 
Constructor Details- 
MockConsumerFactory
 
- 
- 
Method Details- 
getConfigurationPropertiesDescription copied from interface:ConsumerFactoryReturn an unmodifiable reference to the configuration map for this factory. Useful for cloning to make a similar factory.- Specified by:
- getConfigurationPropertiesin interface- ConsumerFactory<K,- V> 
- Returns:
- the configs.
 
- 
createConsumerpublic org.apache.kafka.clients.consumer.Consumer<K,V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix, @Nullable String clientIdSuffix) Description copied from interface:ConsumerFactoryCreate a consumer with an explicit group id; in addition, the client id suffix is appended to the clientIdPrefix which overrides theclient.idproperty, if present.- Specified by:
- createConsumerin interface- ConsumerFactory<K,- V> 
- Parameters:
- groupId- the group id.
- clientIdPrefix- the prefix.
- clientIdSuffix- the suffix.
- Returns:
- the consumer.
 
- 
createConsumerpublic org.apache.kafka.clients.consumer.Consumer<K,V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix, @Nullable String clientIdSuffix, @Nullable Properties properties) Description copied from interface:ConsumerFactoryCreate a consumer with an explicit group id; in addition, the client id suffix is appended to the clientIdPrefix which overrides theclient.idproperty, if present. In addition, consumer properties can be overridden if the factory implementation supports it.- Specified by:
- createConsumerin interface- ConsumerFactory<K,- V> 
- Parameters:
- groupId- the group id.
- clientIdPrefix- the prefix.
- clientIdSuffix- the suffix.
- properties- the properties to override.
- Returns:
- the consumer.
 
- 
isAutoCommitpublic boolean isAutoCommit()Description copied from interface:ConsumerFactoryReturn true if consumers created by this factory use auto commit.- Specified by:
- isAutoCommitin interface- ConsumerFactory<K,- V> 
- Returns:
- true if auto commit.
 
 
-