Active MQ+Redis-based synchronous message queue

A technology for synchronizing messages and message queues, applied in communication between programs, instruments, multi-program devices, etc., can solve problems such as distributed message queue message program failures, and achieve the effect of avoiding system chaos

Inactive Publication Date: 2017-08-25
弘成科技发展有限公司
View PDF5 Cites 18 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] In order to solve the problem that multi-consumer parallel consumption of distributed message queue messages is prone to program failure, realize sequential consumption among multiple

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0032] Synchronous message queue based on Active MQ+Redis, the steps include:

[0033] S1. Create the connection and dialogue of the Active MQ message queue;

[0034] S2. Insert a message into the Active MQ message queue, and the consumer monitors the message;

[0035] S3. The consumer receives the message, and the message received by the consumer is fed back and stored in the list data structure of Redis, which is used to record the order in which the message enters the Active MQ message queue;

[0036] S4. Redis sends distributed locks to consumers holding messages in the order in which messages enter the Active MQ message queue;

[0037] S5. The consumer who has acquired the distributed lock becomes the leader, consumes the messages it holds, releases the distributed lock after the consumption is completed, and continues to listen to the message; the consumer who has not acquired the distributed lock continues to wait for the new message sent by Redis Distributed locks; ...

Embodiment 2

[0045] Synchronous message queue based on Active MQ+Redis, the steps include:

[0046] S1. Create the connection and dialogue of the Active MQ message queue;

[0047] S2. Insert a message into the Active MQ message queue, and the consumer monitors the message;

[0048] S3. The consumer receives the message, and the message received by the consumer is fed back and stored in the list data structure of Redis, which is used to record the order in which the message enters the Active MQ message queue;

[0049] S4. Redis sends distributed locks to consumers holding messages in the order in which messages enter the Active MQ message queue;

[0050] S5. The consumer who has acquired the distributed lock becomes the leader, consumes the messages it holds, releases the distributed lock after the consumption is completed, and continues to listen to the message; the consumer who has not acquired the distributed lock continues to wait for the new message sent by Redis Distributed locks; ...

Embodiment 3

[0057] Synchronous message queue based on Active MQ+Redis, the steps include:

[0058] S1. Create the connection and dialogue of the Active MQ message queue;

[0059] S2. Insert a message into the Active MQ message queue, and the consumer monitors the message;

[0060] S3. The consumer receives the message, and the message received by the consumer is fed back and stored in the list data structure of Redis, which is used to record the order in which the message enters the Active MQ message queue;

[0061] S4. Redis sends distributed locks to consumers holding messages in the order in which messages enter the Active MQ message queue;

[0062] S5. The consumer who has acquired the distributed lock becomes the leader, consumes the messages it holds, releases the distributed lock after the consumption is completed, and continues to listen to the message; the consumer who has not acquired the distributed lock continues to wait for the new message sent by Redis Distributed locks; ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses an Active MQ+Redis-based synchronous message queue. The Active MQ+Redis-based synchronous message queue comprises the following steps of: creating a connection and a dialogue of an Active MQ message queue; inserting messages to the Active MQ message queue; receiving the messages by consumers, and recording the sequence of the messages by a list data structure of a Redis; sending a distributed lock to the consumers by the Redis according to the sequence of the messages; enabling the consumer that obtains the distributed lock as a leader, consuming the messages, releasing the distributed lock after the consumption is finished, and continuing to monitoring the messages; and continuing to waiting for obtaining the distributed lock by the consumers that do not obtain the distributed lock. The Active MQ+Redis-based synchronous message queue has the beneficial effects of solving the problem that program faults are easy to occur when a plurality of consumers consume messages in distributed message queues in parallel, realizing the sequential consumption among the plurality of consumers, and filling the technical gap of the Active MQ+Redis-based synchronous message queue.

Description

technical field [0001] The invention belongs to the technical field of synchronous message queue execution, and in particular relates to a synchronous message queue based on ActiveMQ+Redis. Background technique [0002] In the case of a message queue with only one consumer, if the consumer's machine fails, it cannot complete the full consumption of messages. At this time, if you want to continue to consume messages, you need to switch to other machines for operation, that is, in the system Set up multiple consumer terminals; and the consumption of messages by multiple consumers requires sequential execution. In the scenario where multiple consumers consume messages from a distributed message queue in parallel, how to maintain the sequential consumption among multiple consumers? It is an important problem that needs to be solved urgently. [0003] In actual business scenarios, for example: multiple teachers import student information at the same time, and in the scenario whe...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/54
CPCG06F9/546
Inventor 甄建廷
Owner 弘成科技发展有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products