SpringBoot micro electric service providers to develop practical projects --- Kafka Integrated Access

kafka as a messaging middleware product, she is more lightweight, very good in terms of throughput, the default message is persisted to disk during 168 hours = 7 days, log.retention.hours = 168, more suitable to do the operation statistics. Other small talk, take a look at pom dependent on it

Here I am using version:

kafka.version=2.2.0.RELEASE

Kafka-client.version = 2.0.0

|| news provider

application.properties configuration message provider (Interface Layer):

Message provider transmits message:

||  message consumer

application.properties message consumer's configuration (service layer):

Monitor news:

Kafka Test news:

After a few clicks mad request interface, view the cache redis situation:

We can easily see that the number of times I use Kafka made the product search statistics (just the test code). In the first interface layer, request a commodity per query interface, the product ID is sent to Kafka put the query message queue, and then monitor statistics the number of queries in the service layer.

Until now, the basic configuration of the project and some services integrated access has been achieved, then I would be more in-depth about the project often encountered in the pit and how to prevent not jump pit, and distributed task scheduling management, consistent distributed transactions treatment and so on.

Acquiring the project source code, scan the code number of public attention, and send Springboot get.

Guess you like

Origin www.cnblogs.com/lyn20141231/p/11210300.html