I started by create a basic PHP login system that uses ajax to make API requests.
This API was then adapted to serve as a kafka's producer, sending asynchronous calls to consumer.
These can be one of three topics: create_user, login or recover_password
Depending of the incoming topic, the consumer will act accordingly. Using the config/database connection and/or the objects/user model.
With kafka, in teory, the api folder (producer), the consumer folder (consumer) and the root files (webserver) could all be put in distributed machines so they would be horizontaly scalable.
Requirements
Minimum PHP version: 7.1
Kafka version greater than 0.8 (used 2.1.0)
The consumer module needs kafka broker version greater than 0.9.0
Access your localhost to browse the index, signup and password_recovery pages
Run 'php consumer/consumer.php' to see how the consumer is responding to the different calls
Not working! (Important Considerations)
The calls are only working one way (webserver -> producer -> consumer). For now, I couldn't figure out how to retrieve information from the consumer to the webserver. This means that create_user and password_recovery are both working (they really just need to push information), the login (which require response if the login is valid or not) is not. But you can check the response in the consumer.