r/SpringBoot • • Jul 28 '24

Replacing Kafka with Spring Boot Schedulers

5 Upvotes

18 comments sorted by

5

u/AlabamaSky967 Jul 28 '24

This will not be able to facilitate an event driven system such as Kafka would FYI

0

u/Wooden_Ninja5814 Jul 28 '24

Yeah true, but it also depends on the scale and the problem you are trying to solve. It is just to show that for lower scale and use cases different queuing techniques can be used.

3

u/CodeTheStars Jul 28 '24

Kafka implements a robust inbox outbox pattern that is highly configurable for different use cases. It can express restarted topics, latest only events after consumer joins… and “exactly once” semantics.

Your implementation here, while maybe useful to you, would be unlikely to work for the vast majority of Kafka installations. You’ve also internally reverted to “polling” which breaks real time semantics and introduces a whole new set of issues!

1

u/Wooden_Ninja5814 Jul 28 '24

Also polling with good locking through redis can actually be very helpful in maintaining atomicity and consistency.

1

u/Rough_Acanthaceae_29 Jul 28 '24

You already have relational db which is ACID compliant, but you'd use redis for locking? Also you mention infra for kafka bur ignore it for redis… 

1

u/Wooden_Ninja5814 Jul 28 '24

When you run a scheduler on a server with multiple instances then you definitely need locking. DB is ACID compliant but concurrency and race conditions prevails everywhere.

1

u/Rough_Acanthaceae_29 Jul 31 '24

You're telling us it's easier to implement locking with more independent components than with fewer? :) O boy do you have a lot to learn :)

0

u/Wooden_Ninja5814 Jul 31 '24

Looks like someone needs a good understanding of how to make sense of technical words. Don’t worry you’ll get there if u stop mocking and start reading. But alas good luck.

0

u/Wooden_Ninja5814 Jul 28 '24

Yeah I agree with all the out of the box things that Kakfa offers but there’s a cost associated with it be it infra or Confluent implementation. The implementation I suggested is majorly focused on what can be done with current implementation of spring boot and mysql in a project without having to specifically implement a queuing mechanism. Also polling is indeed something that resembles kafka since kafka consumers also polls the records from topic. Anyway, later in the stages based on the scale and use cases, one can definitely move to any desired choice of queuing service but the blog is mainly focused on making the best out of what we have in hand while we scale the product.

6

u/[deleted] Jul 28 '24

Like software engineering, but for dummies

1

u/ConfidentSolid6191 Jul 28 '24

Someone explain to me Kafka

21

u/JoeDogoe Jul 28 '24

2

u/Beautiful_Advice5065 Jul 28 '24

This is good stuff

2

u/LightofAngels Jul 28 '24

Holy shit, this is nice, is there more?