How to implement asynchronous point of praise and comments

Asynchronously queues.

As shown below

 

 

Asynchronous here to achieve, as a way of using redis task queue, the sequence of events by redis into the queue, send it to consumers through events deserialization.

Event consumers, through an EventHandler interface to handle different events.

public  interface the EventHandler {
 // for processing event 
doHandle (EventModel Model); 

// Returns the type of event that can be handled 
List <the EventType> getSupportedTypes (); 

}

Event dispatcher through to jedisqueue lpush events, consumer jedisqueue from the brpop be serialized events, and to de-serialize from applicationContext acquired Eventhandler implementation class to implement thumbs up or comment.

 

Guess you like

Origin www.cnblogs.com/bowenqianngzhibushiwo/p/11600877.html