Spring Boot+kafka Integration (not yet adjourned)

Source: Internet
Author: User
Tags ack

Springboot version is 2.0.4

In the process of integration, spring boot helped us to bring out most of the properties of Kafka, but some of the less common attributes needed to be

spring.kafka.consumer.properties.*

To set, for example, Max.partition.fetch.bytes, a fetch request, records maximum value obtained from a partition.

Add the Kafka Extension property in Application.properties.

#设置一次fetch记录的最大值2M (2*1024*1024), the default value is 1mspring.kafka.consumer.properties.max.partition.fetch.bytes= 2097152

For more configuration Please refer to the Kafka property Daquan

1 # APACHE KAFKA (kafkaproperties)2Spring.kafka.admin.client-id= # ID to pass to the server when making requests. Used forserver-side logging.3spring.kafka.admin.fail-fast=false# Whether to fail fastifThe broker is not a available on startup.4spring.kafka.admin.properties.*= # Additional admin-specific properties used to configure the client.5spring.kafka.admin.ssl.key-password= # Password of thePrivatekey in the key store file.6spring.kafka.admin.ssl.keystore-location=# Location of the key store file.7spring.kafka.admin.ssl.keystore-password= # Store Password forThe key store file.8Spring.kafka.admin.ssl.keystore-type=# Type of the key store.9Spring.kafka.admin.ssl.protocol=# SSL protocol to use.Tenspring.kafka.admin.ssl.truststore-location=# Location of the Trust store file. Onespring.kafka.admin.ssl.truststore-password= # Store Password forThe Trust store file. ASpring.kafka.admin.ssl.truststore-type=# Type of the Trust store. -spring.kafka.bootstrap-servers= # comma-delimited List of host:port pairs to use forestablishing the initial connection to the Kafka cluster. -Spring.kafka.client-id= # ID to pass to the server when making requests. Used forserver-side logging. theSpring.kafka.consumer.auto-commit-interval= # Frequency with which the consumer offsets is auto-committed to Kafkaif' Enable.auto.commit ' is set totrue. -spring.kafka.consumer.auto-offset-reset= # What to DoWhen there are no initial offset in Kafka orifThe current offset is no longer exists on the server. -spring.kafka.consumer.bootstrap-servers= # comma-delimited List of host:port pairs to use forestablishing the initial connection to the Kafka cluster. -Spring.kafka.consumer.client-id= # ID to pass to the server when making requests. Used forserver-side logging. +spring.kafka.consumer.enable-auto-commit= # Whether The consumer ' s offset is periodically committed in the background. -spring.kafka.consumer.fetch-max-wait= # Maximum amount of time the server blocks before answering the fetch requestifThere isn ' t sufficient data to immediately satisfy the requirement given by "fetch.min.bytes". +Spring.kafka.consumer.fetch-min-size= # Minimum amount of data, in bytes, the server shouldreturn  fora fetch request. ASpring.kafka.consumer.group-id= # Unique String that identifies the consumer group to which Thisconsumer belongs. atSpring.kafka.consumer.heartbeat-interval=# expected time between heartbeats to the consumer coordinator. -Spring.kafka.consumer.key-deserializer= # Deserializerclass  forkeys. -spring.kafka.consumer.max-poll-records=# Maximum number of records returned in a single call to poll (). -spring.kafka.consumer.properties.*= # Additional consumer-specific properties used to configure the client. -spring.kafka.consumer.ssl.key-password= # Password of thePrivatekey in the key store file. -spring.kafka.consumer.ssl.keystore-location=# Location of the key store file. inspring.kafka.consumer.ssl.keystore-password= # Store Password forThe key store file. -Spring.kafka.consumer.ssl.keystore-type=# Type of the key store. toSpring.kafka.consumer.ssl.protocol=# SSL protocol to use. +spring.kafka.consumer.ssl.truststore-location=# Location of the Trust store file. -spring.kafka.consumer.ssl.truststore-password= # Store Password forThe Trust store file. theSpring.kafka.consumer.ssl.truststore-type=# Type of the Trust store. *Spring.kafka.consumer.value-deserializer= # Deserializerclass  forvalues. $Spring.kafka.jaas.control-flag=required # Control Flag forlogin configuration.Panax NotoginsengSpring.kafka.jaas.enabled=false# Whether to enable JAAS configuration. -spring.kafka.jaas.login-module=com.sun.security.auth.module.Krb5LoginModule # Login module. thespring.kafka.jaas.options=# Additional JAAS options. +spring.kafka.listener.ack-count= # Number of records between offset commits when Ackmode is "count" or "Count_time". ASpring.kafka.listener.ack-mode= # Listener Ackmode. See the spring-Kafka documentation. theSpring.kafka.listener.ack-time= # Time between offset commits when Ackmode is "time" or "Count_time". +Spring.kafka.listener.client-id= # Prefix forThe listener ' s consumer client.id property. -spring.kafka.listener.concurrency=# Number of threads to run in the listener containers. $Spring.kafka.listener.idle-event-interval=# Time between publishing idle consumer events (no data received). $spring.kafka.listener.log-container-config=# Whether to log the container configuration during initialization (INFO level). -Spring.kafka.listener.monitor-interval= # Time between checks fornon-responsive consumers. If a duration suffix is not specified, seconds would be used. -spring.kafka.listener.no-poll-threshold= # Multiplier applied to ' polltimeout ' to determineifA consumer is non-Responsive. thespring.kafka.listener.poll-timeout=# Timeout to use when polling the consumer. -Spring.kafka.listener.type=Single # Listener type.Wuyispring.kafka.producer.acks=# Number of acknowledgments The producer requires the leader to has received before considering a request complete.< /c4> theSpring.kafka.producer.batch-size=# Default Batch size in bytes. -spring.kafka.producer.bootstrap-servers= # comma-delimited List of host:port pairs to use forestablishing the initial connection to the Kafka cluster. Wuspring.kafka.producer.buffer-memory=# Total bytes of memory the producer can use to buffer records waiting to being sent to the server. -Spring.kafka.producer.client-id= # ID to pass to the server when making requests. Used forserver-side logging. AboutSpring.kafka.producer.compression-type= # compression type forAll data generated by the producer. $Spring.kafka.producer.key-serializer= # Serializerclass  forkeys. -spring.kafka.producer.properties.*= # Additional producer-specific properties used to configure the client. -spring.kafka.producer.retries=# when greater than zero, enables retrying of failed sends. -spring.kafka.producer.ssl.key-password= # Password of thePrivatekey in the key store file. Aspring.kafka.producer.ssl.keystore-location=# Location of the key store file. +spring.kafka.producer.ssl.keystore-password= # Store Password forThe key store file. theSpring.kafka.producer.ssl.keystore-type=# Type of the key store. -Spring.kafka.producer.ssl.protocol=# SSL protocol to use. $spring.kafka.producer.ssl.truststore-location=# Location of the Trust store file. thespring.kafka.producer.ssl.truststore-password= # Store Password forThe Trust store file. theSpring.kafka.producer.ssl.truststore-type=# Type of the Trust store. thespring.kafka.producer.transaction-id-prefix= # When non empty, enables transaction support forproducer. theSpring.kafka.producer.value-serializer= # Serializerclass  forvalues. -spring.kafka.properties.*=# Additional Properties, common to producers and consumers, used to configure the client. inspring.kafka.ssl.key-password= # Password of thePrivatekey in the key store file. thespring.kafka.ssl.keystore-location=# Location of the key store file. thespring.kafka.ssl.keystore-password= # Store Password forThe key store file. AboutSpring.kafka.ssl.keystore-type=# Type of the key store. theSpring.kafka.ssl.protocol=# SSL protocol to use. thespring.kafka.ssl.truststore-location=# Location of the Trust store file. thespring.kafka.ssl.truststore-password= # Store Password forThe Trust store file. +Spring.kafka.ssl.truststore-type=# Type of the Trust store. -Spring.kafka.template.default-topic= # Default topic to which messages is sent.

Official Document Address:

https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/reference/htmlsingle/#common-application-properties

Spring Boot+kafka Integration (not yet adjourned)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.