Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code samples around Spring Boot and Kafka.

License

NotificationsYou must be signed in to change notification settings

loicgreffier/spring-boot-kafka-quickstarts

Repository files navigation

Apache KafkaSpring Boot

Spring Boot and Kafka Quickstarts

GitHub BuildKafka VersionSpring Boot VersionGitHub StarsDocker PullsSonarCloud TestsLicense

ProducerConsumerStreams

Code samples around Kafka Clients and Kafka Streams leveraging Spring Boot to simplify the development of applications.

Prerequisites

  • Java 21
  • Maven
  • Docker

Quickstarts

Producers

ModuleLibraryDescription
Avro GenericKafka ClientsProduce generic Avro records
Avro SpecificKafka ClientsProduce specific Avro records
HeadersKafka ClientsProduce records with headers
SimpleKafka ClientsProduce String records
TransactionKafka ClientsProduce to multiple topics while guaranteeing atomicity

Consumers

ModuleLibraryDescription
Avro GenericKafka ClientsConsume generic Avro records
Avro SpecificKafka ClientsConsume specific Avro records
Exactly Once ProcessingKafka ClientsConsume–process–produce loop with transactions
Exception DeserializationKafka ClientsConsume records while handling deserialization exceptions
Exception Processing RetryKafka ClientsConsume records with retry logic for processing exceptions
HeadersKafka ClientsConsume records with headers
SimpleKafka ClientsConsume String records
TransactionKafka ClientsConsume records from committed transactions

Kafka Streams

Source

ModuleLibraryDSL
Global TableKafka StreamsSource topic as global tableglobalTable()
TableKafka StreamsSource topic as tabletable()
StreamKafka StreamsSource topic as streamstream()

Stateless

ModuleLibraryDescriptionDSL
BranchKafka StreamsSplit and create branches from a streamsplit(),branch()
CogroupKafka StreamsAggregate records of multiple streams by keycogroup()
FilterKafka StreamsRetain or drop records based on a predicatefilter(),filterNot()
FlatMapKafka StreamsChange one record into 0, 1 orn recordsflatMap()
FlatMapValuesKafka StreamsChange one record value into 0, 1 orn record valuesflatMapValues()
ForeachKafka StreamsPerform a terminal operation on each recordforeach()
MapKafka StreamsChange one record into another recordmap()
MapValuesKafka StreamsChange one record value into another record valuemapValues()
MergeKafka StreamsMerge two streams into one streammerge()
PrintKafka StreamsPrint a stream to the system output or a fileprint()
RepartitionKafka StreamsTrigger a repartitioning of the streamrepartition()
SelectKeyKafka StreamsChange the key of each recordselectKey()

Aggregate

ModuleLibraryDescriptionDSL
AggregateKafka StreamsAggregate a stream by key in a single objectgroupByKey(),aggregate()
Aggregate Hopping WindowKafka StreamsAggregate a stream by key and by hopping window with a grace periodgroupByKey(),aggregate(),windowedBy(),advanceBy()
Aggregate Sliding WindowKafka StreamsAggregate a stream by key and by sliding window with a grace periodgroupByKey(),aggregate(),windowedBy()
Aggregate Tumbling WindowKafka StreamsAggregate a stream by key and by tumbling window with a grace periodgroupByKey(),aggregate(),windowedBy()
AverageKafka StreamsCompute an average value of a stream by keygroupBy(),aggregate()
CountKafka StreamsCount the number of records of a stream by keygroupBy(),count()
ReduceKafka StreamsReduce the records of a stream by keygroupBy(),reduce()

Join

ModuleLibraryDescriptionDSL
Join Stream-Global TableKafka StreamsPerform an inner join between a stream and a global tablejoin()
Join Stream-StreamKafka StreamsPerform an inner join between two streamsjoin()
Join Stream-TableKafka StreamsPerform an inner join between a stream and a tablejoin()
Left Join Stream-Global TableKafka StreamsPerform a left join between a stream and a global tableleftJoin()
Left Join Stream-StreamKafka StreamsPerform a left join between two streamsleftJoin()
Left Join Stream-TableKafka StreamsPerform a left join between a stream and a tableleftJoin()
Outer Join Stream-StreamKafka StreamsPerform an outer join between two streamsouterJoin()

Windowing

ModuleLibraryDescriptionDSL
Hopping WindowKafka StreamsGroup records by hopping window with a grace periodwindowedBy(),advanceBy()
Sliding WindowKafka StreamsGroup records by sliding window with a grace periodwindowedBy()
Tumbling WindowKafka StreamsGroup records by tumbling window with a grace periodwindowedBy()

Processor

ModuleLibraryDescriptionDSLProcessor API
ProcessKafka StreamsApply a processor to a streamprocess()context(),forward(),Record#headers()
ProcessValuesKafka StreamsApply a fixed key processor to a streamprocessValues()context(),forward(),Record#headers()
ReconciliationKafka StreamsReconcile events across two streamsselectKey(),repartition(),process(),addStateStore()getStateStore(),forward(),Record#headers()
ScheduleKafka StreamsSchedule punctuation functions based on wall clock time and stream timeprocess()schedule(),getStateStore()

Stores

ModuleLibraryDescriptionDSLProcessor API
Store CleanupKafka StreamsSchedule periodic store cleanup based on stream timeprocess()schedule(),getStateStore()
Key-Value StoreKafka StreamsInsert and retrieve records from a key-value storeprocess(),addStateStore()getStateStore()
Timestamped Key-Value StoreKafka StreamsInsert and retrieve records from a timestamped key-value storeprocess(),addStateStore()getStateStore()
Window StoreKafka StreamsInsert and retrieve records from a window storeprocess(),addStateStore()getStateStore()
Timestamped Window StoreKafka StreamsInsert and retrieve records from a timestamped window storeprocess(),addStateStore()getStateStore()

Handler

ModuleLibraryDescriptionConfig
Deserialization Exception HandlerKafka StreamsHandle deserialization exceptionsdeserialization.exception.handler
Processing Exception Handler DSLKafka StreamsHandle processing exceptions in DSL operationsprocessing.exception.handler
Processing Exception Handler Processor APIKafka StreamsHandle processing exceptions in Processor APIprocessing.exception.handler
Production Exception HandlerKafka StreamsHandle production and serialization exceptionsproduction.exception.handler

Credits

Confluent - Crossing the Streams

Bill Bejeck - Windowing time semantics

Apache Kafka - Sliding Windows

Jeanlouisboudart - Retriable Consumer

About

Code samples around Spring Boot and Kafka.

Topics

Resources

License

Stars

Watchers

Forks

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp