public class KafkaMessageChannelBinder extends MessageChannelBinderSupport
| Stream definition | Kafka topic | Kafka partitions | Notes |
|---|---|---|---|
| foo = "http | log" | foo.0 | 1 partition | 1 producer, 1 consumer |
| foo = "http | log", log.count=x | foo.0 | x partitions | 1 producer, x consumers with static group 'springXD', achieves queue semantics |
| foo = "http | log", log.count=x + XD partitioning | still 1 topic 'foo.0' | x partitions + use key computed by XD | 1 producer, x consumers with static group 'springXD', achieves queue semantics |
| foo = "http | log", log.count=x, concurrency=y | foo.0 | x*y partitions | 1 producer, x XD consumers, each with y threads |
| foo = "http | log", log.count=0, x actual log containers | foo.0 | 10(configurable) partitions | 1 producer, x XD consumers. Can't know the number of partitions beforehand, so decide a number that better be greater than number of containers |
| Modifier and Type | Class and Description |
|---|---|
static class |
KafkaMessageChannelBinder.Mode |
static class |
KafkaMessageChannelBinder.StartOffset |
MessageChannelBinderSupport.DirectHandler, MessageChannelBinderSupport.PartitioningMetadata, MessageChannelBinderSupport.SetBuilder, MessageChannelBinderSupport.SharedChannelProvider<T extends org.springframework.messaging.MessageChannel>| Modifier and Type | Field and Description |
|---|---|
static String |
AUTO_COMMIT_ENABLED |
static org.apache.kafka.common.serialization.ByteArraySerializer |
BYTE_ARRAY_SERIALIZER |
static String |
COMPRESSION_CODEC |
static String |
FETCH_SIZE |
static int |
METADATA_VERIFICATION_MAX_INTERVAL |
static int |
METADATA_VERIFICATION_RETRY_ATTEMPTS |
static double |
METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER |
static int |
METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL |
protected static Set<Object> |
PRODUCER_COMPRESSION_PROPERTIES |
static String |
QUEUE_SIZE |
static String |
REQUIRED_ACKS |
static org.I0Itec.zkclient.serialize.ZkSerializer |
utf8Serializer
Used when writing directly to ZK.
|
CONSUMER_RETRY_PROPERTIES, CONSUMER_STANDARD_PROPERTIES, defaultBackOffInitialInterval, defaultBackOffMaxInterval, defaultBackOffMultiplier, defaultBatchBufferLimit, defaultBatchingEnabled, defaultBatchSize, defaultBatchTimeout, defaultCompress, defaultConcurrency, defaultDurableSubscription, defaultMaxAttempts, directChannelProvider, evaluationContext, logger, MEDIATYPES_MEDIATYPE_ALL, PARTITION_HEADER, PRODUCER_BATCHING_ADVANCED_PROPERTIES, PRODUCER_BATCHING_BASIC_PROPERTIES, PRODUCER_PARTITIONING_PROPERTIES, PRODUCER_STANDARD_PROPERTIES| Constructor and Description |
|---|
KafkaMessageChannelBinder(org.springframework.integration.kafka.support.ZookeeperConnect zookeeperConnect,
String brokers,
String zkAddress,
String... headersToMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
Binding<org.springframework.messaging.MessageChannel> |
bindProducer(String name,
org.springframework.messaging.MessageChannel moduleOutputChannel,
Properties properties) |
org.springframework.integration.kafka.listener.KafkaMessageListenerContainer |
createMessageListenerContainer(Properties properties,
String group,
int maxConcurrency,
String topic,
long referencePoint) |
protected Binding<org.springframework.messaging.MessageChannel> |
doBindConsumer(String name,
String group,
org.springframework.messaging.MessageChannel inputChannel,
Properties properties) |
void |
doManualAck(LinkedList<org.springframework.messaging.MessageHeaders> messageHeadersList) |
org.springframework.integration.kafka.core.ConnectionFactory |
getConnectionFactory() |
KafkaMessageChannelBinder.StartOffset |
getStartOffset() |
boolean |
isResetOffsets() |
void |
setDefaultAutoCommitEnabled(boolean defaultAutoCommitEnabled)
Set the default auto commit enabled property; This is used to commit the offset either automatically or
manually.
|
void |
setDefaultCompressionCodec(String defaultCompressionCodec) |
void |
setDefaultFetchSize(int defaultFetchSize) |
void |
setDefaultMaxWait(int defaultMaxWait) |
void |
setDefaultMinPartitionCount(int defaultMinPartitionCount) |
void |
setDefaultQueueSize(int defaultQueueSize) |
void |
setDefaultReplicationFactor(int defaultReplicationFactor) |
void |
setDefaultRequiredAcks(int defaultRequiredAcks) |
void |
setMode(KafkaMessageChannelBinder.Mode mode) |
void |
setOffsetStoreBatchBytes(int offsetStoreBatchBytes) |
void |
setOffsetStoreBatchTime(int offsetStoreBatchTime) |
void |
setOffsetStoreMaxFetchSize(int offsetStoreMaxFetchSize) |
void |
setOffsetStoreRequiredAcks(int offsetStoreRequiredAcks) |
void |
setOffsetStoreRetentionTime(int offsetStoreRetentionTime) |
void |
setOffsetStoreSegmentSize(int offsetStoreSegmentSize) |
void |
setOffsetStoreTopic(String offsetStoreTopic) |
void |
setOffsetUpdateCount(int offsetUpdateCount) |
void |
setOffsetUpdateShutdownTimeout(int offsetUpdateShutdownTimeout) |
void |
setOffsetUpdateTimeWindow(int offsetUpdateTimeWindow) |
void |
setResetOffsets(boolean resetOffsets) |
void |
setRetryOperations(org.springframework.retry.RetryOperations retryOperations)
Retry configuration for operations such as validating topic creation
|
void |
setSocketBufferSize(int socketBufferSize) |
void |
setStartOffset(KafkaMessageChannelBinder.StartOffset startOffset) |
static void |
validateTopicName(String topicName)
Allowed chars are ASCII alphanumerics, '.', '_' and '-'.
|
addBinding, afterUnbind, applyPrefix, bindConsumer, buildPartitionRoutingExpression, buildRetryTemplateIfRetryEnabled, constructDLQName, deserializePayloadIfNecessary, deserializePayloadIfNecessary, determinePartition, doBindDynamicProducer, getApplicationContext, getBeanFactory, getIdGenerator, groupedName, serializePayloadIfNecessary, setApplicationContext, setCodec, setDefaultBackOffInitialInterval, setDefaultBackOffMaxInterval, setDefaultBackOffMultiplier, setDefaultBatchBufferLimit, setDefaultBatchingEnabled, setDefaultBatchSize, setDefaultBatchTimeout, setDefaultCompress, setDefaultConcurrency, setDefaultDurableSubscription, setDefaultMaxAttempts, setIntegrationEvaluationContext, setPartitionSelector, stopBindings, unbind, validateConsumerProperties, validateProducerPropertiespublic static final org.apache.kafka.common.serialization.ByteArraySerializer BYTE_ARRAY_SERIALIZER
public static final int METADATA_VERIFICATION_RETRY_ATTEMPTS
public static final double METADATA_VERIFICATION_RETRY_BACKOFF_MULTIPLIER
public static final int METADATA_VERIFICATION_RETRY_INITIAL_INTERVAL
public static final int METADATA_VERIFICATION_MAX_INTERVAL
public static final String FETCH_SIZE
public static final String QUEUE_SIZE
public static final String REQUIRED_ACKS
public static final String COMPRESSION_CODEC
public static final String AUTO_COMMIT_ENABLED
public static final org.I0Itec.zkclient.serialize.ZkSerializer utf8Serializer
public void setOffsetStoreTopic(String offsetStoreTopic)
public void setOffsetStoreSegmentSize(int offsetStoreSegmentSize)
public void setOffsetStoreRetentionTime(int offsetStoreRetentionTime)
public void setSocketBufferSize(int socketBufferSize)
public void setOffsetStoreRequiredAcks(int offsetStoreRequiredAcks)
public void setOffsetStoreMaxFetchSize(int offsetStoreMaxFetchSize)
public void setOffsetUpdateTimeWindow(int offsetUpdateTimeWindow)
public void setOffsetUpdateCount(int offsetUpdateCount)
public void setOffsetUpdateShutdownTimeout(int offsetUpdateShutdownTimeout)
public void setOffsetStoreBatchBytes(int offsetStoreBatchBytes)
public void setOffsetStoreBatchTime(int offsetStoreBatchTime)
public org.springframework.integration.kafka.core.ConnectionFactory getConnectionFactory()
public void setRetryOperations(org.springframework.retry.RetryOperations retryOperations)
retryOperations - the retry configurationpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class MessageChannelBinderSupportExceptionpublic static void validateTopicName(String topicName)
public void setDefaultReplicationFactor(int defaultReplicationFactor)
public void setDefaultCompressionCodec(String defaultCompressionCodec)
public void setDefaultRequiredAcks(int defaultRequiredAcks)
public void setDefaultAutoCommitEnabled(boolean defaultAutoCommitEnabled)
defaultAutoCommitEnabled - public void setDefaultQueueSize(int defaultQueueSize)
public void setDefaultFetchSize(int defaultFetchSize)
public void setDefaultMinPartitionCount(int defaultMinPartitionCount)
public void setDefaultMaxWait(int defaultMaxWait)
public void setMode(KafkaMessageChannelBinder.Mode mode)
public boolean isResetOffsets()
public void setResetOffsets(boolean resetOffsets)
public KafkaMessageChannelBinder.StartOffset getStartOffset()
public void setStartOffset(KafkaMessageChannelBinder.StartOffset startOffset)
protected Binding<org.springframework.messaging.MessageChannel> doBindConsumer(String name, String group, org.springframework.messaging.MessageChannel inputChannel, Properties properties)
doBindConsumer in class MessageChannelBinderSupportpublic Binding<org.springframework.messaging.MessageChannel> bindProducer(String name, org.springframework.messaging.MessageChannel moduleOutputChannel, Properties properties)
public org.springframework.integration.kafka.listener.KafkaMessageListenerContainer createMessageListenerContainer(Properties properties, String group, int maxConcurrency, String topic, long referencePoint)
public void doManualAck(LinkedList<org.springframework.messaging.MessageHeaders> messageHeadersList)
doManualAck in class MessageChannelBinderSupportCopyright © 2016 Pivotal Software, Inc.. All rights reserved.