Kafka and JMS both are messaging system. Java message service is an api which are provided by Java. It is used for implementing messaging system in your application. JMS supports queue and publisher /subscriber(topic) messaging system . With queues, when first consumer consumes a message, message gets deleted from the queue and others cannot take it anymore. With topics, multiple consumers receive each message but it is much harder to scale.
Kafka is a generalization of these two concepts - it allows scaling between members of the same consumer group, but it also allows broadcasting the same message between many different consumer groups. Kafka also provides automatic rebalancing when new consumer join or left the consumer group.
|Sr. No.||Key||Apache Kafka||JMS|
|1||Basic||Apache Kafka is a distributed publish-subscribe messaging system that receives data from disparate source systems and makes the data available to target systems in real time.||Java message service is an api which are provided by Java. It is used for implementing messaging system in your application.|
|2||Pull /Push Mechanism||It used pull mechanism, client need to poll for the message every time ||It used push based model, message can be broadcast to all consumers|
|3||Message Retention Policy||It is policy based||Acknowledgment based|
|4.||Auto Rebalancing||It provides autoblancing when new consumer add or remove from consumer group||It doesn't provide autorebalncing|
|5||Order of Messages||Kafka ensures that the messages are received in the order in which they were sent at the partition level||JMS does not support ordering message.|