CN106789732B - Method for routing foundation and system based on message queue - Google Patents

Method for routing foundation and system based on message queue Download PDF

Info

Publication number
CN106789732B
CN106789732B CN201611048526.2A CN201611048526A CN106789732B CN 106789732 B CN106789732 B CN 106789732B CN 201611048526 A CN201611048526 A CN 201611048526A CN 106789732 B CN106789732 B CN 106789732B
Authority
CN
China
Prior art keywords
application agent
queue
message
management device
routing iinformation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611048526.2A
Other languages
Chinese (zh)
Other versions
CN106789732A (en
Inventor
夏龙伟
胡毅
郭双拴
康明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Vsettan Data Technology Co ltd
Original Assignee
华胜信泰信息产业发展有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华胜信泰信息产业发展有限公司 filed Critical 华胜信泰信息产业发展有限公司
Priority to CN201611048526.2A priority Critical patent/CN106789732B/en
Publication of CN106789732A publication Critical patent/CN106789732A/en
Application granted granted Critical
Publication of CN106789732B publication Critical patent/CN106789732B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/622Queue service order
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6255Queue scheduling characterised by scheduling criteria for service slots or service orders queue load conditions, e.g. longest queue first

Abstract

The invention discloses a kind of method for routing foundation and system based on message queue.The described method includes: route exploration message is sent to the remote queue in the connected queue management device of the first Application Agent by the first Application Agent;Second Application Agent reads route exploration message from the local queue in itself connected queue management device, the first routing iinformation of the first Application Agent is generated to according to the parsing result to routing probe message, and the remote queue transmission into the connected queue management device of the second Application Agent replies message;First Application Agent is received from the local queue in itself connected queue management device reply message after, according to the secondary route information for being generated to the second Application Agent to the parsing result replied message.Using the present invention, may be implemented to construct the routing iinformation based on message queue automatically by Application Agent.

Description

Method for routing foundation and system based on message queue
Technical field
The present invention relates to network communication technology field more particularly to a kind of method for routing foundation based on message queue and it is System.
Background technique
A kind of important form of the message-oriented middleware as middleware Technology provides reliable message communicating hand for application system Section realizes the communication of different operating system platform, library and hardware system platform.
As one kind of message-oriented middleware, message queue (Message queue, MQ) technology is exchanged between Distributed Application A kind of technology of information.Message queue can reside on memory or disk, and message is put into message queue by sender of the message, disappear Breath recipient takes out message from message queue.Can for message queue definition message discrepancy sequence, such as first in first out or According to priority etc..
In MQ system, message queue definition is managed in queue management device, and by it.It is provided by queue management device Messaging service based on queue.Message queue in queue management device includes local queue and remote queue.Local queue is to answer Pass through the queue that application programming interface (API) is written and read it with program;Remote queue is destination queue at this The definition on ground, it is similar to an address pointer, some destination queue being directed toward on distance host.
Fig. 1 shows the existing process that message distribution is carried out using message queue technology.Referring to Fig. 1, in step S11 In, the first application program (APP1) sends a message to the remote queue in the connected queue management device 1 (QM1) of APP1;In step In rapid S12, the message is sent to the connected queue management device 2 of the second application program (APP2) by message queue network (QM2) local queue in, the local queue are destination queue pointed by remote queue in QM1;In step s 13, APP2 reads the message of APP1 transmission from the local queue;In step S14, APP2 is replied message the message The remote queue being sent in QM2;In step S15, described reply message is transferred in QM1 by message queue network Local queue, the local queue are destination queue pointed by remote queue in QM2;In step s 16, APP1 is from QM1 In local queue in read described in reply message.
The above process is disadvantageous in that, before APP1 sends a message to remote queue, APP1 is needed from system pipes Reason person place obtains to reach in advance and distally apply, that is, the routing iinformation of APP2.Typically, system manager can be with explicit side Formula notifies above-mentioned routing iinformation to APP1.That is, applying journey before the interaction of execution message among applications The routing iinformation pre-saved to remote application is needed in sequence, so that the exploitation ratio of the application program based on message queue Routing letter that is more difficult, also, when the topological structure between message queue changes, needing accordingly to change in application program Breath, and above-mentioned change procedure is frequently necessary to spend the extra time.
Summary of the invention
In view of the above technical problems, the embodiment of the invention provides a kind of method for routing foundation based on message queue and it is System constructs the routing iinformation based on message queue by Application Agent to realize automatically.
On the one hand, the embodiment of the invention provides a kind of method for routing foundation based on message queue, which comprises
Route exploration message is sent to the connected queue management device of the first Application Agent by the first Application Agent In remote queue;
Second Application Agent is read from the local queue in the connected queue management device of the second Application Agent After the route exploration message, the route exploration message is parsed, according to parsing result determination and was generated to for the first application program generation First routing iinformation of reason, and it is remote into the connected queue management device of the second Application Agent according to first routing iinformation Journey queue transmission replies message;And
First Application Agent is read from the local queue in the connected queue management device of the first Application Agent After getting described reply message, parses this and reply message, the second tunnel of the second Application Agent is generated to according to parsing result By information.
On the other hand, the embodiment of the invention also provides a kind of the Route establishment system based on message queue, the system Include:
First Application Agent, for route exploration message to be sent to the connected queue pipe of the first Application Agent Manage the remote queue in device;And
Second Application Agent, for being read from the local queue in the connected queue management device of the second Application Agent After getting the route exploration message, the route exploration message is parsed, according to parsing result determination and is generated to first using journey The first routing iinformation of sequence agency, and according to first routing iinformation into the connected queue management device of the second Application Agent Remote queue transmission reply message;
Wherein, first Application Agent is from the sheet in the connected queue management device of the first Application Agent Ground queue reads described after replying message, and parses this and replies message, is generated to second application program according to parsing result The secondary route information of agency.
In method for routing foundation and system provided by the invention based on message queue, the first Application Agent is to second Application Agent sends route exploration message, so that the second Application Agent is established according to route exploration message to first The routing iinformation of Application Agent, and, the second Application Agent is replied message to the transmission of the first Application Agent, is made The first Application Agent is obtained according to the routing iinformation established to the second Application Agent is replied message, to realize logical It crosses Application Agent and constructs the routing iinformation based on message queue automatically, do not needed before being communicated between application program in advance Routing iinformation is obtained from system manager, so that the exploitation of the application program based on message queue is more easier, and is made Routing iinformation on Application Agent can carry out therewith dynamic more according to the variation of the topological structure between message queue Newly.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, of the invention other Feature, objects and advantages will become more apparent upon:
Fig. 1 is the flow diagram of the message interaction process between the application program that the prior art provides;
Fig. 2 is the flow diagram for the method for routing foundation based on message queue that first embodiment of the invention provides;
Fig. 3 is the flow diagram for the method for routing foundation based on message queue that second embodiment of the invention provides;
Fig. 4 is the flow diagram for the method for routing foundation based on message queue that third embodiment of the invention provides;
Fig. 5 is the network topological diagram for the Route establishment system based on message queue that fourth embodiment of the invention provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
First embodiment
Fig. 2 shows the flow charts for the method for routing foundation based on message queue that first embodiment of the invention provides.? In the present embodiment, is needing two application programs i.e. the first application program communicated in advance and establishing two between the second application program A agency (agent), the agency established for the first application program is the first Application Agent, is established for the second application program Agency is the second Application Agent.At least one queue management device of first Application Agent and the first application program local Connection, the second Application Agent are connect at least one queue management device of the second application program local, every team's column manager Local queue therein and remote queue are managed.
Referring to fig. 2, the present embodiment the method for routing foundation based on message queue the following steps are included:
Step 21: route exploration message is sent to the connected queue of the first Application Agent by the first Application Agent Remote queue in manager;
In this step, the first Application Agent after actuation, to the connected queue management device of the first Application Agent In remote queue send route exploration message, may include first using journey in the route exploration message sent to remote queue Mark, the mark of the connected queue management device of the first Application Agent, the connected team of the first Application Agent of sequence agency The mark of local queue in column manager and the mark of the remote queue.
The connected team of the first Application Agent is sent in the route exploration message that the first Application Agent is sent After remote queue in column manager, the route exploration message in the remote queue is sent to second by message queue network Local queue in the connected queue management device of Application Agent, the local queue are the remote queues in route exploration message Pointed destination queue.
Step 22: the second Application Agent is from the local queue in the connected queue management device of the second Application Agent After reading the route exploration message, the route exploration message is parsed, according to parsing result determination and is generated to the first application First routing iinformation of programmatic agent, and according to first routing iinformation to the connected queue management device of the second Application Agent In remote queue transmission reply message;
In this step, the second Application Agent handles the connected queue management device of the second Application Agent after actuation In the route exploration message that receives of local queue.
Firstly, the second Application Agent passes through parsing route exploration message, available first Application Agent Mark, the mark of the connected queue management device of the first Application Agent, the connected queue management device of the first Application Agent In local queue mark and the remote queue in the connected queue management device of the first Application Agent mark.
Then, the second Application Agent determines the second Application Agent institute according to the configuration information locally pre-saved Connect it is in queue management device, with the connect queue management device of the first Application Agent parsed and described first using journey Sequence acts on behalf of remote queue corresponding to the local queue in connected queue management device, which is to be directed to parse The remote queue of local queue in the connected queue management device of first Application Agent.
It is answered next, the second Application Agent generates the second Application Agent according to determining remote queue to first With routing iinformation i.e. the first routing iinformation of programmatic agent, the first routing iinformation indicates that the second Application Agent can be by true Fixed remote queue sends message to the first Application Agent.Second Application Agent adds the first routing iinformation of generation Enter into the first local routing table.
Subsequent second application program is needing to send message to the first Application Agent by the second Application Agent When, the second application program transmits the message to the second Application Agent, the second Application Agent by inquiry it is local the One routing table acquires the routing iinformation of the first Application Agent, and sends a message to and be located at indicated by the routing iinformation The remote queue in queue management device that second Application Agent is connected, the message are sent to by message queue network Local queue in the connected queue management device of first Application Agent, then the first Application Agent is from the local queue The first application program is sent to after reading message.What needs to be explained here is that if the second Application Agent is by inquiring this First routing table on ground obtains a plurality of routing iinformation to the first Application Agent, then can select according to preset routing It selects a good opportunity and makes to select a wherein routing iinformation and send message to the first Application Agent using the routing iinformation of selection.
Second Application Agent replies message, this is replied message after determining remote queue to remote queue transmission In may include the first Application Agent for including in the mark and route exploration message of the second Application Agent and connected The mark of remote queue in queue management device.The connected queue management of the second Application Agent is sent to replying message After remote queue in device, replying message in the remote queue was sent to for the first application program generation by message queue network Manage the local queue in connected queue management device.
Step 23: the first Application Agent is from the local in the connected queue management device of the first Application Agent Queue receives reply message after, parse this and reply message, be generated to the second of the second Application Agent according to parsing result Routing iinformation.
In this step, the first Application Agent is replied message by what the first Application Agent of parsing was sent, is obtained The mark of remote queue in the mark and the connected queue management device of the first Application Agent of second Application Agent.The One Application Agent is believed according to the routing that the information being resolved to generates the first Application Agent to the second Application Agent Breath is secondary route information, and secondary route information indicates that the first Application Agent can be long-range by include in replying message Queue sends message to the second Application Agent.The secondary route information of generation is added to local by the first Application Agent Secondary route table in.
Subsequent first application program is needing to send message to the second Application Agent by the first Application Agent When, the first application program transmits the message to the first Application Agent, the first Application Agent by inquiry it is local the Two routing tables acquire the routing iinformation of the second Application Agent, and send a message to and be located at indicated by the routing iinformation The remote queue in queue management device that first Application Agent is connected, the message are sent to by message queue network Local queue in the connected queue management device of second Application Agent, then the second Application Agent is from the local queue The second application program is sent to after reading message.What needs to be explained here is that if the first Application Agent is by inquiring this The secondary route table on ground obtains a plurality of routing iinformation to the second Application Agent, then can be selected according to preset routing It selects a good opportunity and makes to select a wherein routing iinformation and send message to the second Application Agent using the routing iinformation of selection.
In the present embodiment, the first Application Agent sends route exploration message to the second Application Agent, so that the Two Application Agents establish the routing iinformation to the first Application Agent according to route exploration message, and, second answers With programmatic agent to the first Application Agent transmission reply message so that the first Application Agent according to reply message foundation To the routing iinformation of the second Application Agent, constructed automatically based on message queue to realize by Application Agent Routing iinformation, do not need to obtain routing iinformation from system manager in advance before being communicated between application program, so that base It is more easier in the exploitation of the application program of message queue, and enables routing iinformation on Application Agent according to disappearing It ceases the variation of the topological structure between queue and carries out dynamic update therewith.
Second embodiment
Fig. 3 shows the process signal of the method for routing foundation based on message queue of second embodiment of the invention offer Figure.In the present embodiment, the first application program (APP1) is associated with the first Application Agent (agent1), agent1 and team Column manager 1 (QM1) is connected, and remote queue 2 (RQ2) and local queue 1 (QL1) are provided in QM1;Second application program (APP2) associated with the second Application Agent (agent2), agent2 is connected with queue management device 2 (QM2), sets in QM2 It is equipped with remote queue 1 (RQ1) and local queue 2 (QL2);It is between Application Agent and queue management device in the present embodiment One-to-one relationship.This gives the method for building up of the routing iinformation between agent1 and agent2 should referring to Fig. 3 Method includes the following steps:
Step 31:agent1 sends route exploration message to RQ2 after actuation, includes agent1 in the route exploration message Mark, the mark of QM1, the mark of the mark of QL1 and RQ2, i.e., comprising such as next group information in route exploration message (agent1, QM1, QL1, RQ2);
Step 32: after route exploration message is sent to RQ2, the route exploration message in RQ2 passes through message queue (MQ) network is sent to QL2;
Step 33:agent2 reads route exploration message from QL2 after actuation;
Agent2 parses the route exploration message read, obtains information group (agent1, QM1, QL1, RQ2), determines QM2 In remote queue corresponding with QM1 and QL1 be RQ1;The routing iinformation of agent2 to agent1 is generated, is wrapped in the routing iinformation Corresponding relationship containing QM2, RQ1 and agent1, i.e. (QM2, RQ1- > agent1);If in the first local routing table not with The identical routing iinformation of the routing iinformation generated then the routing iinformation of generation is written in the first local routing table, Otherwise the routing iinformation of generation is abandoned;
Step 34:agent2 to RQ1 transmission reply message, this reply message in comprising agent2 mark and RQ2 mark Know, that is, reply message in comprising such as next group information (agent2, RQ2);It certainly, can also include QM2 and QL2 in replying message Identification information.
Step 35: after replying message and being sent to RQ1, replying message in RQ1 is sent by message queue network To QL1.
Step 36:agent1 reads from QL1 and replies message;
What agent1 parsing was read replies message, and obtains message groups (agent2, RQ2), generates agent1 to agent2 Routing iinformation, include the corresponding relationship of QM1, RQ2 and agent2 in the routing iinformation, i.e., (QM1, RQ2- > agent2);If The identical routing iinformation of the routing iinformation for not having in the secondary route table of the local agent1 and generating, then by the road of generation By otherwise abandoning the routing iinformation of generation in information write-in secondary route table.
The routing iinformation (QM2, RQ1- > agent1) of agent1 is established on agent2 and is established on agent1 After to the routing iinformation (QM1, RQ2- > agent2) of agent2, subsequent APP2 is needing to send by agent2 to agent1 When message, APP2 transmits the message to agent2, and agent2 acquires the road of agent1 by the first local routing table of inquiry By information (QM2, RQ1- > agent1), the RQ1 in QM2 indicated by the routing iinformation is sent a message to, the message is by disappearing Breath queue (MQ) network is sent to QL1 from RQ1, and then agent1 is sent to APP1 after reading message from QL1.After likewise, For continuous APP1 when needing to send message to agent2 by agent1, APP1 transmits the message to agent1, and agent1 is by looking into The routing iinformation (QM1, RQ2- > agent2) that local secondary route table acquires agent2 is ask, the routing is sent a message to RQ2 in QM1 indicated by information, the message are sent to QL2 from RQ2 by message queue (MQ) network, then agent2 APP2 is sent to after reading message from QL2.
It present embodiments provides between Application Agent and queue management device when being one-to-one relationship, application program generation The establishment process of routing iinformation between reason realizes the routing letter constructed automatically by Application Agent based on message queue Breath.When routing iinformation, which is established, sends message to another application program with the latter application program, Application Agent is only needed Know which agent is another application program be associated with, passes through the mark of the agent in the mark table of query and routing of agent Then corresponding remote queue sends a message to the remote queue, which can be by message queue transmission of network to another Application Agent.When the agent that the remote queue that an application program is locally defined is directed toward changes, corresponding routing Route exploration message that information can be sent according to the agent after variation and automatically update, and message queue network and application program The build process of agency all transfers to system manager to operate, so as to so that developer no longer need to concern queue variation it is more special Infuse the development in business.
3rd embodiment
Fig. 4 shows the process signal of the method for routing foundation based on message queue of third embodiment of the invention offer Figure.The present embodiment and embodiment two the difference is that, between the Application Agent and queue management device in the present embodiment It is that one-to-many relationship namely Application Agent are connected with multiple queue management devices, the present embodiment is with Application Agent It is illustrated for being connected with two queue management devices.Wherein, the first application program (APP1) and the first Application Agent (agent1) it is associated, agent1 is connected with queue management device 1 (QM1) and queue management device 3 (QM3), is provided in QM1 remote Journey queue 2 (RQ2) and local queue 1 (QL1) are provided with remote queue 4 (RQ4) and local queue 3 (QL3) in QM3;Second answers It is associated with the second Application Agent (agent2) with program (APP2), agent2 and queue management device (QM2) and queue pipe Reason device 4 (QM4) is connected, and remote queue 1 (RQ1) and local queue 2 (QL2) are provided in QM2, is provided with long-range team in QM4 Column 3 (RQ3) and local queue 4 (QL4).
In the present embodiment, routing iinformation is established by QM1 and QM2 between agent1 and agent2, method for building up can be with Referring to the description of step 31- step 36 in embodiment two, which is not described herein again.
In the present embodiment, routing iinformation is also established by QM3 and QM4 between agent1 and agent2, referring to fig. 4, is built Cube method includes the following steps:
Step 41:agent1 sends route exploration message to RQ4 after actuation, includes agent1 in the route exploration message Mark, the mark of QM3, the mark of the mark of QL3 and RQ4, i.e., comprising such as next group information in route exploration message (agent1, QM3, QL3, RQ4);
Step 42: after route exploration message is sent to RQ4, the route exploration message in RQ4 passes through message queue net Network is sent to QL4;
Step 43:agent2 reads route exploration message from QL4 after actuation;
Agent2 parses the route exploration message read, obtains information group (agent1, QM3, QL3, RQ4), determines QM4 In remote queue corresponding with QM3 and QL3 be RQ3;The routing iinformation of agent2 to agent1 is generated, is wrapped in the routing iinformation Corresponding relationship containing QM4, RQ3 and agent1, i.e. (QM4, RQ3- > agent1);If in the first local routing table not with The routing iinformation of generation is then written in the first routing table, is otherwise lost by the identical routing iinformation of the routing iinformation generated Abandon the routing iinformation generated.
Step 44:agent2 to RQ3 transmission reply message, this reply message in comprising agent2 mark and RQ4 mark Know, that is, reply message in comprising such as next group information (agent2, RQ4);It certainly, can also include QM4 and QL4 in replying message Identification information.
Step 45: after replying message and being sent to RQ3, replying message through message queue (MQ) network quilt in RQ3 It is sent to QL3.
Step 46:agent1 reads from QL3 and replies message;
What agent1 parsing was read replies message, and obtains message groups (agent2, RQ4), generates agent1 to agent2 Routing iinformation, include the corresponding relationship of QM3, RQ4 and agent2 in the routing iinformation, i.e., (QM3, RQ4- > agent2);If The identical routing iinformation of the routing iinformation for not having in local secondary route table and generating, then by the routing iinformation of generation It is written in secondary route table, otherwise abandons the routing iinformation of generation.
By the above process, two routing iinformations (QM2, RQ1- > agent1) of agent1 are established on agent2 (QM4, RQ3- > agent1), and establish on agent1 agent2 two routing iinformations (QM1, RQ2- > Agent2) and (QM3, RQ4- > agent2), for subsequent APP2 when needing to send message to agent1 by agent2, APP2 will Message is sent to agent2, and agent2 acquires two routing iinformations of agent1 by the first local routing table of inquiry (QM2, RQ1- > agent1) and (QM4, RQ3- > agent1) selects a wherein road according to preset routing mechanism By information, RQ1 indicated by the routing iinformation of selection or RQ3 is sent a message to, which passes through message queue network (MQ) It is sent to QL1 or QL3 from RQ1 or RQ3, then agent1 is sent to APP1 after reading message from QL1 or QL3.After likewise, For continuous APP1 when needing to send message to agent2 by agent1, APP1 transmits the message to agent1, and agent1 is by looking into Ask local secondary route table acquire agent2 two routing iinformations (QM1, RQ2- > agent2) and (QM3, RQ4- > Agent2), a wherein routing iinformation is selected according to preset routing mechanism, sends a message to the routing of selection RQ2 indicated by information or RQ4, the message are sent to QL2 or QL4 from RQ2 or RQ4 by message queue (MQ) network, so Agent2 is sent to APP2 after reading message from QL2 or QL4 afterwards.
As it can be seen that the first via that the second Application Agent generates in the embodiment of the present invention includes determining long-range team by information The mark of queue management device and the mark of the first Application Agent where the mark of column, the remote queue of determination;By the first via After in the first local routing table of information write-in, when receiving the message for needing to be sent to the first Application Agent, The routing iinformation of mark of the inquiry comprising the first Application Agent in the first local routing table, if inquiry obtains a routing Information then sends a message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If inquiring To a plurality of routing iinformation, then a routing iinformation is selected from a plurality of routing iinformation according to setting routing mechanism, will disappeared Cease the remote queue being sent in queue management device indicated by the routing iinformation of selection.
Likewise, the secondary route information that the first Application Agent generates includes the connected team of the first Application Agent Team where remote queue in the mark of remote queue in column manager, the connected queue management device of the first Application Agent The mark of column manager and the mark of the second Application Agent;First Application Agent secondary route information is written local Secondary route table in after, when receiving the message for needing to be sent to the second Application Agent, in local secondary route The routing iinformation of mark of the inquiry comprising the second Application Agent in table, if inquiry obtains a routing iinformation, by message The remote queue being sent in queue management device indicated by the routing iinformation that inquiry obtains;If inquiry obtains a plurality of routing letter Breath then selects a routing iinformation according to setting routing mechanism from a plurality of routing iinformation, sends a message to selection Routing iinformation indicated by remote queue in queue management device.
Routing mechanism therein can include but is not limited to following two:
First, select routing iinformation, such as the first Application Agent according to the according to the instruction of corresponding application program The instruction of one application program selects routing iinformation, and the second Application Agent selects routing letter according to the instruction of the second application program Breath;
Second, for Application Agent when carrying out the transmission of message using every routing iinformation, record is from sending a message to The time interval of the message replied message is received, and Application Agent will record the current state of every routing iinformation Whether occupied, the following table 1 gives agent2 when carrying out the transmission of message using routing iinformation (QM4, RQ3- > agent1), One example of the content of record.When there are a plurality of routing iinformation between two Application Agents, according to the more of record The corresponding time interval of routing iinformation and whether occupied information, a road is selected from a plurality of routing iinformation By information, for example the smallest routing iinformation of unappropriated and time interval is selected to carry out the transmission of message.
Table 1
It present embodiments provides when being one-to-many relationship between Application Agent and queue management device, application program generation The establishment process of routing iinformation between reason realizes the routing letter constructed automatically by Application Agent based on message queue Breath.When routing iinformation, which is established, sends message to another application program with the latter application program, Application Agent is only needed Know which agent is another application program be associated with, passes through the mark of the agent in the mark table of query and routing of agent Corresponding remote queue selects a remote queue according to certain routing mechanism when inquiring multiple remote queues, Then the remote queue is sent a message to, which can be by message queue transmission of network to another application programmatic agent.When When the agent that the remote queue that one application program is locally defined is directed toward changes, corresponding routing iinformation can be according to variation Route exploration message that agent afterwards is sent and automatically update, and the build process of message queue network and agency are all transferred to System manager's operation, so as to so that developer no longer needs to the development that concern queue variation focuses more on business.
Fourth embodiment
Fig. 5 shows the network of the Route establishment system based on message queue of fourth embodiment of the invention offer.Ginseng See Fig. 5, should Route establishment system based on message queue include: the first Application Agent 51, the second Application Agent 52, The queue management device that first Application Agent is connected i.e. first queue manager 53 and the second Application Agent are connected Queue management device, that is, second queue manager 54, in which:
First Application Agent 51, for route exploration message to be sent to the connected team of the first Application Agent 51 Remote queue in column manager 53;
Second Application Agent 52, for from the local in the connected queue management device 54 of the second Application Agent 52 After queue receives the route exploration message, the route exploration message is parsed, according to parsing result determination and is generated to first First routing iinformation of Application Agent 51, and will be replied message according to first routing iinformation and be sent to the second application program Act on behalf of the remote queue in 52 connected queue management devices 54;
Wherein, first Application Agent 51 is from the connected queue management device 53 of first Application Agent 51 In local queue read described reply message after, parse this and reply message, be generated to described second according to parsing result and answer With the secondary route information of programmatic agent 52.
Further, the mark in the route exploration message comprising first Application Agent 51, described first The mark of the connected queue management device 53 of Application Agent 51, the connected queue management device of first Application Agent 51 The mark of the mark of local queue in 53, remote queue in the connected queue management device 53 of first Application Agent 51 Know;
Correspondingly, second Application Agent 52 is determining according to parsing result and is generated to the first Application Agent 51 the first routing iinformation, and according to first routing iinformation into the connected queue management device 54 of the second Application Agent 52 Remote queue send and reply message method particularly includes:
The connected queue pipe of second Application Agent 52 is determined according to the parsing result of the route exploration message Manage device 54 in, with the connect queue management device 53 of first Application Agent 51 and first Application Agent 51 Remote queue corresponding to local queue in connected queue management device 53 generates described second according to determining remote queue Application Agent and sends to reply and disappear to the first routing iinformation of the first Application Agent 51 to determining remote queue Breath.
Further, it is described reply message in include the second Application Agent 52 mark and first application program Act on behalf of the mark of the remote queue in 51 connected queue management devices 53;
Correspondingly, first Application Agent 51 is generated to the of the second Application Agent 52 according to parsing result The specific method is as follows for two routing iinformations:
In the connected queue management device 53 of first Application Agent 51 replied message according to parsing The mark of remote queue and the mark of second Application Agent 52 generate first Application Agent 51 and arrive institute State the secondary route information of the second Application Agent 52.
Further, second Application Agent 52 is connect with one or more queue management devices, the first via It include the mark of queue management device and institute where the mark of the remote queue of the determination, the remote queue of the determination by information State the mark of the first Application Agent 51;
Second Application Agent 52 is also used to: after generating the first routing iinformation, by the first via by believing In the first local routing table of breath write-in;When receiving the message for needing to be sent to the first Application Agent 51, in local The first routing table in inquiry comprising first Application Agent mark routing iinformation, if inquiry obtain one routing Information then sends the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If looking into Inquiry obtains a plurality of routing iinformation, then a routing iinformation is selected from a plurality of routing iinformation according to setting routing mechanism, Send the message to the remote queue in queue management device indicated by the routing iinformation of selection.
Further, first Application Agent 51 is connect with one or more queue management devices, second tunnel Include the mark of the remote queue in the connected queue management device 53 of first Application Agent by information, described first answer The mark of queue management device and described second applies journey where the remote queue in the connected queue management device 53 of programmatic agent The mark of sequence agency 52;
First Application Agent 51 is also used to: after generating secondary route information, the secondary route being believed In the local secondary route table of breath write-in;When receiving the message for needing to be sent to the second Application Agent 52, in local Secondary route table in inquiry comprising second Application Agent mark routing iinformation, if inquiry obtain one routing Information then sends the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If looking into Inquiry obtains a plurality of routing iinformation, then a routing iinformation is selected from a plurality of routing iinformation according to setting routing mechanism, Send the message to the remote queue in queue management device indicated by the routing iinformation of selection.
Application Agent and its queue management device connected in the present embodiment can be set in same terminal or clothes It is engaged on device, also can be set on different terminals or server.
The present invention has carried out the automatic foundation of routing iinformation using the reply mechanism of message queue, while to application program screen The details of queue is covered, so that the application and development based on message queue becomes to be more easier, application program no longer needs to pay close attention to team The information of column, it is only necessary to be associated with local Application Agent, Application Agent can send a message to opposite end application program Agency, this scheme is but also application program is not necessarily to pay close attention to the modification of bottom message queue network.
The above description is only a preferred embodiment of the present invention, is not intended to restrict the invention, for those skilled in the art For, the invention can have various changes and changes.All any modifications made within the spirit and principles of the present invention are equal Replacement, improvement etc., should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of method for routing foundation based on message queue characterized by comprising
Route exploration message is sent in the connected queue management device of the first Application Agent by the first Application Agent Remote queue;
Second Application Agent reads described from the local queue in the connected queue management device of the second Application Agent After route exploration message, the route exploration message, the configuration information locally pre-saved according to the second Application Agent are parsed The first routing iinformation that is determining with parsing result and being generated to the first Application Agent, and according to first routing iinformation to the Remote queue transmission in the connected queue management device of two Application Agents replies message;And
First Application Agent is read from the local queue in the connected queue management device of the first Application Agent It is described reply message after, parse this and reply message, according to parsing result be generated to the second Application Agent secondary route believe Breath.
2. the method according to claim 1, wherein applying journey comprising described first in the route exploration message Mark, the mark of the connected queue management device of the first Application Agent, first Application Agent of sequence agency It is remote in the mark of local queue in connected queue management device, the connected queue management device of the first Application Agent The mark of journey queue;
The configuration information locally pre-saved according to the second Application Agent and parsing result determination are simultaneously generated to first First routing iinformation of Application Agent, and according to first routing iinformation to the connected queue pipe of the second Application Agent The step of remote queue transmission in reason device replies message, comprising:
The configuration information and parsing result locally pre-saved according to the second Application Agent determines second application program Act on behalf of it is in connected queue management device, applied with the connect queue management device of first Application Agent and described first Remote queue corresponding to local queue in the connected queue management device of programmatic agent generates institute according to determining remote queue The second Application Agent is stated to the first routing iinformation of first Application Agent, and is sent to determining remote queue It replies message.
3. according to the method described in claim 2, it is characterized in that, it is described reply message in comprising the second Application Agent The mark of remote queue in mark and the connected queue management device of the first Application Agent;
The step of secondary route information that the second Application Agent is generated to according to parsing result, comprising:
The mark of the remote queue in the connected queue management device of the first Application Agent obtained according to parsing and institute The mark for stating the second Application Agent generates first Application Agent to the second of second Application Agent Routing iinformation.
4. according to the method described in claim 2, it is characterized in that, second Application Agent and one or more queues Manager connection, the first via include the mark of remote queue of the determination, the remote queue institute of the determination by information In the mark of queue management device and the mark of first Application Agent;
After generating the first routing iinformation, the method also includes: second Application Agent by the first via by In the first local routing table of information write-in;When receiving the message for needing to be sent to the first Application Agent, in local The first routing table in inquiry comprising first Application Agent mark routing iinformation, if inquiry obtain one routing Information then sends the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If looking into Inquiry obtains a plurality of routing iinformation, then a routing iinformation is selected from a plurality of routing iinformation according to setting routing mechanism, Send the message to the remote queue in queue management device indicated by the routing iinformation of selection.
5. according to the method described in claim 3, it is characterized in that, first Application Agent and one or more queues Manager connection, the secondary route information include the long-range team in the connected queue management device of the first Application Agent The mark of queue management device where remote queue in the mark of column, the connected queue management device of the first Application Agent With the mark of second Application Agent;
After generating secondary route information, the method also includes: first Application Agents by the secondary route In the local secondary route table of information write-in;When receiving the message for needing to be sent to the second Application Agent, in local Secondary route table in inquiry comprising second Application Agent mark routing iinformation, if inquiry obtain one routing Information then sends the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If looking into Inquiry obtains a plurality of routing iinformation, then a routing iinformation is selected from a plurality of routing iinformation according to setting routing mechanism, Send the message to the remote queue in queue management device indicated by the routing iinformation of selection.
6. a kind of Route establishment system based on message queue characterized by comprising
First Application Agent, for route exploration message to be sent to the connected queue management device of the first Application Agent In remote queue;And
Second Application Agent, for being read from the local queue in the connected queue management device of the second Application Agent After the route exploration message, the route exploration message, the configuration locally pre-saved according to the second Application Agent are parsed Information and parsing result determination and the first routing iinformation for being generated to the first Application Agent, and according to first routing iinformation Remote queue transmission into the connected queue management device of the second Application Agent replies message;
Wherein, first Application Agent is from the local team in the connected queue management device of the first Application Agent It arranges after reading described reply message, parses this and reply message, second Application Agent is generated to according to parsing result Secondary route information.
7. system according to claim 6, which is characterized in that apply journey comprising described first in the route exploration message Mark, the mark of the connected queue management device of the first Application Agent, first Application Agent of sequence agency It is remote in the mark of local queue in connected queue management device, the connected queue management device of the first Application Agent The mark of journey queue;
Second Application Agent is specifically used for:
The parsing result of the configuration information and the route exploration message that are locally pre-saved according to the second Application Agent is true It is in fixed the connected queue management device of second Application Agent, with the connect queue pipe of first Application Agent Remote queue corresponding to the local queue in device and the connected queue management device of the first Application Agent is managed, according to true Fixed remote queue generates second Application Agent to first routing iinformation of first Application Agent, And it is replied message to determining remote queue transmission.
8. system according to claim 7, which is characterized in that it is described reply message in comprising the second Application Agent The mark of remote queue in mark and the connected queue management device of the first Application Agent;
First Application Agent is specifically used for:
The long-range team in the connected queue management device of the first Application Agent replied message according to parsing The mark of column and the mark of second Application Agent generate first Application Agent and apply journey to described second The secondary route information of sequence agency.
9. system according to claim 7, which is characterized in that second Application Agent and one or more queues Manager connection, the first via include the mark of remote queue of the determination, the remote queue institute of the determination by information In the mark of queue management device and the mark of first Application Agent;
Second Application Agent is also used to: after generating the first routing iinformation, first routing iinformation being written In the first local routing table;When receiving the message for needing to be sent to the first Application Agent, in the local first via By inquiring the routing iinformation of the mark comprising first Application Agent in table, if inquiry obtains a routing iinformation, Send the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If inquiry obtains more Routing iinformation then selects a routing iinformation according to setting routing mechanism from a plurality of routing iinformation, disappears described Cease the remote queue being sent in queue management device indicated by the routing iinformation of selection.
10. system according to claim 8, which is characterized in that first Application Agent and one or more teams Column manager connection, the secondary route information include long-range in the connected queue management device of the first Application Agent The mark of queue management device where remote queue in the mark of queue, the connected queue management device of the first Application Agent Know the mark with second Application Agent;
First Application Agent is also used to: after generating secondary route information, the secondary route information being written In local secondary route table;When receiving the message for needing to be sent to the second Application Agent, on the second local tunnel By inquiring the routing iinformation of the mark comprising second Application Agent in table, if inquiry obtains a routing iinformation, Send the message to the remote queue in queue management device indicated by the routing iinformation that inquiry obtains;If inquiry obtains more Routing iinformation then selects a routing iinformation according to setting routing mechanism from a plurality of routing iinformation, disappears described Cease the remote queue being sent in queue management device indicated by the routing iinformation of selection.
CN201611048526.2A 2016-11-21 2016-11-21 Method for routing foundation and system based on message queue Active CN106789732B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611048526.2A CN106789732B (en) 2016-11-21 2016-11-21 Method for routing foundation and system based on message queue

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611048526.2A CN106789732B (en) 2016-11-21 2016-11-21 Method for routing foundation and system based on message queue

Publications (2)

Publication Number Publication Date
CN106789732A CN106789732A (en) 2017-05-31
CN106789732B true CN106789732B (en) 2019-08-06

Family

ID=58910466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611048526.2A Active CN106789732B (en) 2016-11-21 2016-11-21 Method for routing foundation and system based on message queue

Country Status (1)

Country Link
CN (1) CN106789732B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108712332B (en) 2018-05-17 2020-07-07 华为技术有限公司 Communication method, system and device
CN112671819A (en) * 2020-08-17 2021-04-16 紫光云技术有限公司 Distributed message communication method based on redis

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020036050A (en) * 2000-11-07 2002-05-16 박종섭 Apparatus for controlling queue for communication among tasks and method there of
CN101431476A (en) * 2008-12-12 2009-05-13 中国工商银行股份有限公司 Data transmission method based on message queue, server and system
CN102217258A (en) * 2011-04-12 2011-10-12 华为技术有限公司 Detection processing method, data transmitter, data receiver and communication system
CN105471760A (en) * 2014-09-12 2016-04-06 华为技术有限公司 Routing method, load balancing device and data communication system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020036050A (en) * 2000-11-07 2002-05-16 박종섭 Apparatus for controlling queue for communication among tasks and method there of
CN101431476A (en) * 2008-12-12 2009-05-13 中国工商银行股份有限公司 Data transmission method based on message queue, server and system
CN102217258A (en) * 2011-04-12 2011-10-12 华为技术有限公司 Detection processing method, data transmitter, data receiver and communication system
CN105471760A (en) * 2014-09-12 2016-04-06 华为技术有限公司 Routing method, load balancing device and data communication system

Also Published As

Publication number Publication date
CN106789732A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
US6222536B1 (en) Method and apparatus for providing a number of subscribers with on-line banking service employing a plurality of bank systems
US5664207A (en) Systems and methods for automatically sharing information among remote/mobile nodes
US8010598B2 (en) Relay server and client terminal
CN1788474B (en) Method, device and system for processing message addressed to client terminal
US8605667B2 (en) Systems and methods for exposing different service facades of an underlying network
US20130346591A1 (en) Clientless Cloud Computing
JP4703169B2 (en) Media server device
US20090138891A1 (en) Integrating service-oriented architecture applications with a common messaging interface
CN101686141B (en) Method and equipment for synchronizing read states
CN106789732B (en) Method for routing foundation and system based on message queue
CN105207885A (en) Method and device for displaying user information in session interface
US7317912B2 (en) Software development environment
CN105704001A (en) WeChat server message distribution method and WeChat server message distribution system
EP1309152B1 (en) System and method for facilitating the selection of electronic services using infrared and a network address identification
CN112689020A (en) Message transmission method, message middleware, electronic equipment and storage medium
CN103731400A (en) Resource sharing system and method
Dave et al. Ponte message broker bridge configuration using mqtt and coap protocol for interoperability of IoT
CN106330492A (en) Method, device and system of configuring user equipment forwarding table
JP2007207013A (en) Information processor and information sharing program
US20100042677A1 (en) Two-way communication system, server unit, repeater, two-way communication method and program
JP2005143100A (en) Erp access method from mobile device
KR20200047028A (en) System and method for peer-to-peer communication in partial mesh network
JP2000293458A (en) Data distribution device, data receiver and controlling method of them
KR101348927B1 (en) Openapi adaptor for wsun
KR20180025174A (en) APPARATUS FOR INTERWORKING IoT DEVICES AND METHOD FOR USING THE SAME

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210825

Address after: Room 402, 4th floor, building 23, East District, yard 10, northwest Wangdong Road, Haidian District, Beijing 100095

Patentee after: VSETTAN INFORMATION INDUSTRY DEVELOPMENT Co.,Ltd.

Patentee after: BEIJING VSETTAN DATA TECHNOLOGY Co.,Ltd.

Address before: 100192 West Zone, 10 / F, block a, No. 8 Xueqing Road (Science and technology wealth center), Haidian District, Beijing

Patentee before: VSETTAN INFORMATION INDUSTRY DEVELOPMENT Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220422

Address after: Room 403, 4th floor, building 23, East District, yard 10, Xibeiwang East Road, Haidian District, Beijing 100089

Patentee after: BEIJING VSETTAN DATA TECHNOLOGY CO.,LTD.

Address before: Room 402, 4th floor, building 23, East District, yard 10, northwest Wangdong Road, Haidian District, Beijing 100095

Patentee before: VSETTAN INFORMATION INDUSTRY DEVELOPMENT CO.,LTD.

Patentee before: Beijing Huasheng Xintai Data Technology Co., Ltd