RabbitMQ use summary (2)

RabbitMQ use summary (2)

1. Requirements: In a java web project, since the method of generating the key pair is very slow, it needs to be generated in advance, and it can be retrieved immediately when it is needed, and it is not allowed to reuse it after it is retrieved. the producer-consumer relationship

2. Solution: If you do not consider the persistence of the message, you can use BlockingQueue. The producer generates a large number of key pairs in advance and puts them in the LinkedBlockingQueue, and then fetches them on demand when they need to be consumed. BlockQueue specific referencehttp ://blog.csdn.net/dfsaggsd/article/details/50573145

3. If you need to make the message persistent, you can consider using the Rabbitmq message queue, specific examples and source code: https://github.com/shisenlin/rabbitmqsb2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325882024&siteId=291194637