CN110515741A - A kind of degradation processing method and device based on local task queue - Google Patents
A kind of degradation processing method and device based on local task queue Download PDFInfo
- Publication number
- CN110515741A CN110515741A CN201810488902.2A CN201810488902A CN110515741A CN 110515741 A CN110515741 A CN 110515741A CN 201810488902 A CN201810488902 A CN 201810488902A CN 110515741 A CN110515741 A CN 110515741A
- Authority
- CN
- China
- Prior art keywords
- task
- sent
- queue
- local
- state
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a kind of degradation processing method and device based on local task queue, is related to field of computer technology.One specific embodiment of this method includes: to be revised as having sent by not sent by the state that state is not sent task;Judge that message queue degrades to switch whether to open, if it is not, then message queue is sent by the task, if so, sending local task queue for the task.The embodiment, which is able to solve message queue cluster delay machine, leads to the not available technical problem of operation system.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of degradation processing method based on local task queue and
Device.
Background technique
In Large-Scale Interconnected net enterprise, big and small system is hundreds and thousands of, MQ (Message Queue, i.e. message team
Column) played in JavaEE (Java Platform Enterprise Edition, i.e. Java enterprise version) system act foot it is light
The role of weight, its main application include: decoupling between system, system peak flow buffering and asynchronous process etc..
By taking train ticket as an example, it is assumed that each system designator code is as follows:
A system: train ticket web system;
B system: train ticket reservation system;
C system: train ticket ticket system;
D system: train ticket timed task;
E system: train ticket operation backstage;
F system: payment gateway system.
When user under A system complete order, and after F system is paid successfully, it is successful that A system to MQ sends a payment
Message, then B system can monitor this successful message of payment for taking MQ, go to call car reservation website progress train number pre-
It orders, after car reservation website, which returns, to be subscribed successfully, B system sends a message of drawing a bill to MQ, and then C system can be monitored and be taken
This message of drawing a bill of MQ goes that car reservation website is called to draw a bill.If MQ cluster causes system can not due to delay machine
With can not continue to provide the user with service then train bill system will thoroughly paralyse.In general, standby MQ cluster (message can be passed through
Queue cluster) method solve the problems, such as that system is not available.Specifically, after main MQ cluster delay machine, each system of train ticket is cut
It changes and is connected to standby MQ cluster, then the message data of persistence is imported into standby MQ cluster, train bill system continues externally to provide
Service.
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery:
1) apply for standby MQ cluster, greatly waste server resource;
2) message data of the persistence of main MQ cluster is imported into standby MQ cluster, and operation difficulty is big and the period is long;
3) it needs to stop service, switchings completion is waited to restart.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of degradation processing method and device based on local task queue, with
Solving message queue cluster delay machine leads to the not available technical problem of operation system.
To achieve the above object, according to an aspect of an embodiment of the present invention, it provides a kind of based on local task queue
Degradation processing method, comprising:
The state that state is not sent task is revised as having sent by not sent;
Judge that message queue degrades to switch whether to open, if it is not, message queue then is sent by the task, if so,
Local task queue is sent by the task.
Optionally, the method also includes:
Judge whether the task sends success, if it is not, then by the state of the task by sent rollback be it is not sent,
If so, terminating.
Optionally, the method also includes:
The local task queue is monitored, when having task in the local task queue, from the local task queue
It is middle to obtain the task, the task is packaged, and send the task after encapsulation in thread pool;
The state of task in thread pool is revised as processed by having sent, and handles the task.
Optionally, the step of handling the task include:
The corresponding operational processor of the type is obtained according to the task type of the task, to the task
Reason;
Judge whether the task processor handles success, if so, terminating;If it is not, then by the task shape of the task
State is not sent by processed rollback.
In addition, other side according to an embodiment of the present invention, provide at a kind of degradation based on local task queue
Manage device, comprising:
Modified module, for the state that state is not sent task to be revised as having sent by not sent;
Whether sending module is opened for judging that message queue degrades to switch, if it is not, then sending message for the task
Queue, if so, sending local task queue for the task.
Optionally, the sending module is also used to:
Judge whether the task sends success, if it is not, then by the state of the task by sent rollback be it is not sent,
If so, terminating.
Optionally, described device further include:
Module is monitored, for monitoring the local task queue, when having task in the local task queue, from described
The task is obtained in local task queue, the task is packaged, and sends the task after encapsulation in thread pool;
Task processing module and handles institute for the state of the task in thread pool to be revised as processed by having sent
State task.
Optionally, the step of handling the task include:
The corresponding operational processor of the type is obtained according to the task type of the task, to the task
Reason;
Judge whether the task processor handles success, if so, terminating;If it is not, then by the task shape of the task
State is not sent by processed rollback.
Other side according to an embodiment of the present invention, additionally provides a kind of electronic equipment, comprising:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes method described in any of the above-described embodiment.
Other side according to an embodiment of the present invention additionally provides a kind of computer-readable medium, is stored thereon with meter
Calculation machine program, realizes method described in any of the above-described embodiment when described program is executed by processor.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that because using first by state by not sent
It is revised as having sent, the technological means that specific tasks send operation is executed further according to the state for the switch that degrades, so overcoming
Message queue cluster delay machine leads to the not available technical problem of operation system, and the present invention is first to be revised as state by not sent
It sends, message queue or local task queue is sent by task further according to the state for the switch that degrades, even if message queue collection
Group's delay machine, services without outer stopping, and system also can guarantee High Availabitity under extreme harsh conditions, and not have to through standby MQ collection
Group solves the problems, such as that system is not available, to solve the problems, such as of the existing technology.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment
With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the main flow of the degradation processing method according to an embodiment of the invention based on local task queue
Schematic diagram;
Fig. 2 is the main of degradation processing method based on local task queue that can refer to embodiment according to the present invention
The schematic diagram of process;
Fig. 3 is the main flow of the degradation processing method in accordance with another embodiment of the present invention based on local task queue
Schematic diagram;
Fig. 4 is another master that can refer to the degradation processing method based on local task queue of embodiment according to the present invention
Want the schematic diagram of process;
Fig. 5 is the signal of the main modular of the downgrade processing device according to an embodiment of the present invention based on local task queue
Figure;
Fig. 6 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 7 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention
Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 is the main flow of the degradation processing method according to an embodiment of the invention based on local task queue
Schematic diagram.As an embodiment of the present invention, as shown in Figure 1, the degradation processing method based on local task queue can
To include:
Step 101, the state that state is not sent task is revised as having sent by not sent.
In this step, it every the task list in predetermined period scan database, inquires and is done well as " not from task list
The task of transmission ", is then revised as " transmission " by " not sent " for the state of these tasks.It for example, can be every 10
Second single pass operation is executed, inquires the task that 200 bar states are " not sent " every time, and by the state of this 200 tasks
" transmission " is revised as by " not sent " one by one;It is also possible to operate every 20 seconds execution single pass, inquires 100 every time
Bar state is the task of " not sent ", and the state of this 100 tasks is revised as " transmission " etc. by " not sent " one by one.
It is pointed out that the embodiment of the present invention with no restriction, is also possible to 60 seconds, 100 seconds etc. the scan period;The embodiment of the present invention
Also with no restriction to the quantity of the task that the state inquired every time is " not sent ", 1000 be can be, it 500 etc., can also
To be arranged according to actual needs.
By taking train ticket operation system as an example, train ticket operation system generates the message storage of the tasks such as subscribing, draw a bill, returning ticket
Into database, by the task list in scan database, the task that a plurality of state is " not sent " is inquired, then by these
The state of task is revised as " transmission " by " not sent ".
Step 102, judge that message queue degrades to switch whether to open, if it is not, message queue then is sent by the task,
If so, sending local task queue for the task.
As another embodiment of the invention, the switch that degrades can be stored in ZooKeeper distributed type assemblies in advance,
Default it to be in off state, when message queue cluster delay machine, message queue is degraded to switch and is opened.
On the basis of step 101, judges that message queue degrades to switch and whether open, if it is not, then description messages queue
Cluster works normally, and sends message queue cluster for task, if it is, description messages queue cluster delay machine, by task
It is sent to local task queue.
As yet another embodiment of the present invention, step 102 can be specifically included:
Judge whether task status is successfully modified;
If successfully modified, continue to judge whether message queue degradation switch is opened, if it is not, then sending the task to
Message queue, if so, sending local task queue for task;
If modification failure, terminates.
It is alternatively possible to judge whether task status is successfully modified by the modified values of database return.For example, returning
Modified values be 1, show that task status is successfully modified, then continue judge that message queue degrades to switch and whether open;What is returned repairs
Revaluate is 0, shows task status modification failure (task may be handled by other systems, can ignore this task), then
Continue to judge whether next task be successfully modified.Optionally, to the modification of task status in database, optimistic locking can be based on
Versions of data recording mechanism realize, avoid the Double Spending of business datum disorder and task message.Moreover, this hair
Bright embodiment can guarantee that task can normally circulate, and be not in the case where MQ degrades switch opening and closing
A certain task is both sent to message queue, while the case where be also sent to local task queue.
As yet another embodiment of the present invention, the method be can further include:
Step 103, judge whether the task sends success, if it is not, then by the state of the task by having sent rollback
To be not sent, if so, terminating.
It after sending message queue or local task queue for task, further determines whether to send successfully, if hair
Success is sent, then is terminated, by " transmission " rollback is " not sent " by the state of task, by next time fixed if sending failure
When task continue to scan on, send.
It is alternatively possible to guarantee the High Availabitity of timed task by ZooKeeper.Specifically, in ZooKeeper distribution collection
In group, the leader (cluster) executed by the wherein server elected as timed task is appointed by the leader
The operation such as scanning and transmission of business (executes step 101, step 102, step 103), when the leader delay machine, then by other clothes
Business device elects new leader and continues to execute timed task.
Optionally, it is the task of " not sent " for a plurality of state inquired, successively executes step 101, step one by one
Rapid 102 and step 103, until terminating.
According to various embodiments recited above, it can be seen that state by using being first revised as by the present invention by not sent
It has been sent that, the technological means that specific tasks send operation is executed further according to the state for the switch that degrades, to solve message team
Column cluster delay machine leads to the not available problem of operation system.That is, the prior art can not by standby MQ cluster solution system
The problem of using.And the present invention is first to be revised as having sent by not sent by state, sends out task further according to the state for the switch that degrades
It is sent to message queue or local task queue services, system is extreme even if message queue cluster delay machine without outer stopping
Under harsh conditions, High Availabitity also can guarantee, and do not have to solve the problems, such as that system is not available by standby MQ cluster, to solve
Problem of the existing technology.
Fig. 2 is the main of degradation processing method based on local task queue that can refer to embodiment according to the present invention
The schematic diagram of process, the degradation processing method based on local task queue may include:
Step 201, scan task table, inquiring a plurality of task status is not sent task;
Step 202, the state that state is not sent task is revised as having sent by not sent;
Step 203, judge whether task status is successfully modified;If so, thening follow the steps 204;If it is not, then terminating;
Step 204, judge that message queue degrades to switch whether to open, if so, thening follow the steps 206;If it is not, then executing step
Rapid 205;
Step 205, message queue is sent by task;
Step 206, local task queue is sent by task;
Step 207, judge whether task sends success;If it is not, thening follow the steps 207;If so, terminating;
It step 208, is not sent by having sent rollback by the state of task.
It should be pointed out that being not sent task for a plurality of task status that scan task table inquires, one by one
Circulation executes step 202-208, until completing the transmission of all tasks.
In addition, in a specific reality that can refer to the degradation processing method based on local task queue in embodiment of the invention
Content is applied, has been described in detail in the degradation processing method described above based on local task queue, therefore in being repeated at this
Appearance no longer illustrates.
Fig. 3 is the main flow of the degradation processing method in accordance with another embodiment of the present invention based on local task queue
Schematic diagram.As another embodiment of the invention, as shown in figure 3, the downgrade processing side based on local task queue
Method may include:
Step 301, the state that state is not sent task is revised as having sent by not sent;
Step 302, judge that message queue degrades to switch whether to open, if it is not, message queue then is sent by the task,
If so, sending local task queue for the task;
Step 303, judge whether the task sends success, if it is not, then by the state of the task by having sent rollback
To be not sent, if so, terminating;
Step 304, the local task queue is monitored, when having task in the local task queue, from the local
The task is obtained in task queue, the task is packaged, and sends the task after encapsulation in thread pool;
Step 305, the state of the task in thread pool is revised as processed by having sent, and handles the task.
Wherein, step 301 is similar with step 101, and step 302 is similar with step 102, and step 303 is similar with step 103,
It repeats no more.
In step 304, local task queue can be monitored by task processor, when listening in local task queue
When having task (being not sky), task is obtained from local task queue, task is packaged into Runnable task, it then will envelope
Task after dress is sent in thread pool.Circulation monitors local task queue, until not having task (as in local task queue
It is empty).
In step 305, the state of the multiple tasks in thread pool is revised as " processed " by " transmission ", then located
Manage these tasks.
Optionally, the step of handling task specifically includes: it is corresponding to obtain the type according to the task type of the task
Operational processor, to handle the task;Judge whether the task processor handles success;If so, terminating;If
It is no, then it is not sent by processed rollback by the task status of the task.
Optionally, it is the task of " transmission " for a plurality of state in thread pool, executes step 305 one by one.Specifically,
For every task: the state of task being revised as " processed " by " transmission ", then executes business processing operation;Go forward side by side one
Step judges whether to handle successfully, if handled successfully, terminates, if processing failure, by the state of task by " processed "
Rollback is " not sent ", again continues to scanning by timed task next time, sends, processing.
It is alternatively possible to judge whether task status is successfully modified by the modified values of database return.For example, returning
Modified values be 1, show that task status is successfully modified;The modified values of return are 0, show task status modification failure (task
It may be handled by other systems, this task can be ignored).It optionally, can be with base to the modification of task status in database
It is realized in the versions of data recording mechanism of optimistic locking, avoids the Double Spending of business datum disorder and task message.
It under extreme scenes, was both received by MQ consumer even if there is a certain task, mould is also handled by local task
Block receives, and before the processing of the task of execution, first can be all revised as the state of task " by " transmission " based on optimistic lock mechanism
Processing ", task only can be consumed (processing) by one of consumption pattern forever.When the modified values of state are 0, mean that
The task is handled by other systems consumption, and currently processed mode then ignores this task.
According to various embodiments recited above, it can be seen that state by using being first revised as by the present invention by having sent
It is processed, then the technological means of specific tasks processing operation is executed, so that solving message queue cluster delay machine leads to business system
It unites not available problem.Even if message queue cluster delay machine, without outer stopping service, system under extreme harsh conditions,
It can guarantee High Availabitity, and do not have to solve the problems, such as that system is not available by standby MQ cluster, to solve prior art presence
The problem of.
Fig. 4 is another master that can refer to the degradation processing method based on local task queue of embodiment according to the present invention
Want the schematic diagram of process.Step 304 and step 305 can with specifically includes the following steps:
Step 401, local task queue is monitored;
Step 402, when having task in local task queue, the task is obtained from the local task queue, it is right
The task is packaged, and sends the task after encapsulation in thread pool;
Step 403, by the state of a plurality of task in thread pool by sent be revised as it is processed;
Step 404, judge whether task status is successfully modified;If so, thening follow the steps 405;If it is not, then terminating;
Step 405, the corresponding operational processor of the type is obtained according to the task type of the task, to the task
It is handled;
Step 406, judge whether task handles success;If it is not, thening follow the steps 407;If so, terminating;
It step 407, is not sent by processed rollback by the task status of the task.
It should be pointed out that recycling hold one by one for being having sent for task by a plurality of task status in thread pool
Row step 403-407, until completing the processing of all tasks.
In addition, another can refer to the specific of the degradation processing method based on local task queue in embodiment in the present invention
Implementation content has been described in detail in the degradation processing method described above based on local task queue, therefore has repeated herein
Content no longer illustrates.
Fig. 5 is the signal of the main modular of the downgrade processing device according to an embodiment of the present invention based on local task queue
Figure, as shown in figure 5, the downgrade processing device 500 based on local task queue includes modified module 501 and sending module
502.Wherein, the state that state is not sent task is revised as having sent by the modified module 501 by not sent;The hair
It send module 502 to judge that message queue degrades to switch whether to open, if it is not, message queue then is sent by the task, if so,
Local task queue is sent by the task.
Optionally, the sending module 502 also judges whether the task sends success, if it is not, then by the task
State is not sent by having sent rollback, if so, terminating.
Optionally, described device further includes monitoring module and task processing module, wherein described in monitoring module monitoring
Local task queue obtains the task from the local task queue when having task in the local task queue, right
The task is packaged, and sends the task after encapsulation in thread pool;The task processing module will be in thread pool
The state of task is revised as processed by having sent, and handles the task.
Optionally, the step of handling the task includes: that obtain the type according to the task type of the task corresponding
Operational processor, to handle the task;Judge whether the task processor handles success, if so, terminating;If
It is no, then it is not sent by processed rollback by the task status of the task.
According to various embodiments recited above, it can be seen that state by using being first revised as by the present invention by not sent
It has been sent that, the technological means that specific tasks send operation is executed further according to the state for the switch that degrades, to solve message team
Column cluster delay machine leads to the not available problem of operation system.That is, the prior art can not by standby MQ cluster solution system
The problem of using.And the present invention is first to be revised as having sent by not sent by state, sends out task further according to the state for the switch that degrades
It is sent to message queue or local task queue services, system is extreme even if message queue cluster delay machine without outer stopping
Under harsh conditions, High Availabitity also can guarantee, and do not have to solve the problems, such as that system is not available by standby MQ cluster.
It should be noted that in the specific implementation of the downgrade processing device of the present invention based on local task queue
Hold, be described in detail in the degradation processing method described above based on local task queue, thus this duplicate contents not
Illustrate again.
Fig. 6 is shown can be using degradation processing method of the embodiment of the present invention based on local task queue or based on this
The exemplary system architecture 600 of the downgrade processing device of ground task queue.
As shown in fig. 6, system architecture 600 may include terminal device 601,602,603, network 604 and server 605.
Network 604 between terminal device 601,602,603 and server 605 to provide the medium of communication link.Network 604 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 601,602,603 and be interacted by network 604 with server 605, to receive or send out
Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 601,602,603
(merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 601,602,603 can be the various electronic equipments with display screen and supported web page browsing, packet
Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 605 can be to provide the server of various services, such as utilize terminal device 601,602,603 to user
The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception
To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter
Breath --- merely illustrative) feed back to terminal device.
It should be noted that the degradation processing method based on local task queue provided by the embodiment of the present invention generally exists
It executes, can also be executed on terminal device 601,602,603 in public places on server 605, it is correspondingly, described based on this
The downgrade processing device of ground task queue is generally located in server 605, and terminal device in public places also can be set
601, on 602,603.
It should be understood that the number of terminal device, network and server in Fig. 6 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 7, it illustrates the computer systems 700 for the terminal device for being suitable for being used to realize the embodiment of the present invention
Structural schematic diagram.Terminal device shown in Fig. 7 is only an example, function to the embodiment of the present invention and should not use model
Shroud carrys out any restrictions.
As shown in fig. 7, computer system 700 includes central processing unit (CPU) 701, it can be read-only according to being stored in
Program in memory (ROM) 702 or be loaded into the program in random access storage device (RAM) 703 from storage section 708 and
Execute various movements appropriate and processing.In RAM 703, also it is stored with system 700 and operates required various programs and data.
CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to always
Line 704.
I/O interface 705 is connected to lower component: the importation 706 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 708 including hard disk etc.;
And the communications portion 709 of the network interface card including LAN card, modem etc..Communications portion 709 via such as because
The network of spy's net executes communication process.Driver 710 is also connected to I/O interface 705 as needed.Detachable media 711, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 710, in order to read from thereon
Computer program be mounted into storage section 708 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention
Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer
Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.In
In such embodiment, which can be downloaded and installed from network by communications portion 709, and/or from can
Medium 711 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 701, system of the invention is executed
The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not
Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires
Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey
The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this
In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned
Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more
Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical
On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule
The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction
It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard
The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet
Include modified module and sending module, wherein the title of these modules does not constitute the limit to the module itself under certain conditions
It is fixed.
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be
Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes
Obtaining the equipment includes: to be revised as having sent by not sent by the state that state is not sent task;Judge that message queue degrades
Whether switch is opened, if it is not, then message queue is sent by the task, if so, sending local task for the task
Queue.
Technical solution according to an embodiment of the present invention, because using first being revised as having sent by not sent by state, then root
The technological means that specific tasks send operation is executed according to the state for the switch that degrades, is led so overcoming message queue cluster delay machine
The not available technical problem of operation system is caused, the present invention is first to be revised as having sent by not sent by state, is opened further according to degradation
Task is sent message queue or local task queue by the state of pass, even if message queue cluster delay machine, without stopping outside
It only services, system also can guarantee High Availabitity under extreme harsh conditions, and not have to unavailable to solve system by standby MQ cluster
The problem of, to solve the problems, such as of the existing technology.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any
Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention
Within.
Claims (10)
1. a kind of degradation processing method based on local task queue characterized by comprising
The state that state is not sent task is revised as having sent by not sent;
Judge that message queue degrades to switch whether to open, if it is not, then message queue is sent by the task, if so, by institute
The task of stating is sent to local task queue.
2. the method according to claim 1, wherein further include:
Judge whether the task sends success, if it is not, be then not sent by having sent rollback by the state of the task, if
It is then to terminate.
3. the method according to claim 1, wherein further include:
The local task queue is monitored, when having task in the local task queue, is obtained from the local task queue
The task is taken, the task is packaged, and sends the task after encapsulation in thread pool;
The state of task in thread pool is revised as processed by having sent, and handles the task.
4. according to the method described in claim 3, it is characterized in that, the step of handling the task includes:
The corresponding operational processor of the type is obtained according to the task type of the task, to handle the task;
Judge whether the task processor handles success, if so, terminating;If it is not, then by the task status of the task by
Processed rollback is not sent.
5. a kind of downgrade processing device based on local task queue characterized by comprising
Modified module, for the state that state is not sent task to be revised as having sent by not sent;
Whether sending module is opened for judging that message queue degrades to switch, if it is not, then sending message team for the task
Column, if so, sending local task queue for the task.
6. device according to claim 5, which is characterized in that the sending module is also used to:
Judge whether the task sends success, if it is not, be then not sent by having sent rollback by the state of the task, if
It is then to terminate.
7. device according to claim 5, which is characterized in that further include:
Module is monitored, for monitoring the local task queue, when having task in the local task queue, from the local
The task is obtained in task queue, the task is packaged, and sends the task after encapsulation in thread pool;
Task processing module and handles described appoint for the state of the task in thread pool to be revised as processed by having sent
Business.
8. device according to claim 7, which is characterized in that the step of handling the task include:
The corresponding operational processor of the type is obtained according to the task type of the task, to handle the task;
Judge whether the task processor handles success, if so, terminating;If it is not, then by the task status of the task by
Processed rollback is not sent.
9. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
The now method as described in any in claim 1-4.
10. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor
The method as described in any in claim 1-4 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810488902.2A CN110515741A (en) | 2018-05-21 | 2018-05-21 | A kind of degradation processing method and device based on local task queue |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810488902.2A CN110515741A (en) | 2018-05-21 | 2018-05-21 | A kind of degradation processing method and device based on local task queue |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110515741A true CN110515741A (en) | 2019-11-29 |
Family
ID=68622148
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810488902.2A Pending CN110515741A (en) | 2018-05-21 | 2018-05-21 | A kind of degradation processing method and device based on local task queue |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110515741A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111061550A (en) * | 2019-12-03 | 2020-04-24 | 北京每日优鲜电子商务有限公司 | Task processing method, device, equipment and storage medium |
CN111314423A (en) * | 2020-01-17 | 2020-06-19 | 青梧桐有限责任公司 | MQ degradation processing method and system based on long-rental apartment task queue |
CN112905335A (en) * | 2021-02-02 | 2021-06-04 | 北京思特奇信息技术股份有限公司 | Switching method for calling multiple sets of system same services and business processing system |
CN113672357A (en) * | 2020-05-15 | 2021-11-19 | 北京沃东天骏信息技术有限公司 | Task scheduling method, device and system |
CN113741797A (en) * | 2020-08-31 | 2021-12-03 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102880475A (en) * | 2012-10-23 | 2013-01-16 | 上海普元信息技术股份有限公司 | Real-time event handling system and method based on cloud computing in computer software system |
US20130198296A1 (en) * | 2012-01-31 | 2013-08-01 | Global Relay Communications Inc. | System and Method for Processing Messages in a Messaging Service |
CN203574673U (en) * | 2013-07-15 | 2014-04-30 | 上海联影医疗科技有限公司 | Message-processing system |
CN104348805A (en) * | 2013-07-31 | 2015-02-11 | 南京中兴力维软件有限公司 | Asynchronous file transmission method, apparatus and system |
CN104598563A (en) * | 2015-01-08 | 2015-05-06 | 北京京东尚科信息技术有限公司 | High concurrency data storage method and device |
CN105306552A (en) * | 2015-09-30 | 2016-02-03 | 中国科学院计算技术研究所 | Consumption equilibrium method and system based on message queues |
CN107104822A (en) * | 2017-03-29 | 2017-08-29 | 杭州云纪网络科技有限公司 | Server preparedness processing method, device, storage medium and electronic equipment |
CN107682169A (en) * | 2016-08-02 | 2018-02-09 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus using Kafka collection pocket transmission message |
CN108009027A (en) * | 2017-11-23 | 2018-05-08 | 北京百度网讯科技有限公司 | Implementation method, device, equipment and the storage medium of queue message uniformity |
-
2018
- 2018-05-21 CN CN201810488902.2A patent/CN110515741A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130198296A1 (en) * | 2012-01-31 | 2013-08-01 | Global Relay Communications Inc. | System and Method for Processing Messages in a Messaging Service |
CN102880475A (en) * | 2012-10-23 | 2013-01-16 | 上海普元信息技术股份有限公司 | Real-time event handling system and method based on cloud computing in computer software system |
CN203574673U (en) * | 2013-07-15 | 2014-04-30 | 上海联影医疗科技有限公司 | Message-processing system |
CN104348805A (en) * | 2013-07-31 | 2015-02-11 | 南京中兴力维软件有限公司 | Asynchronous file transmission method, apparatus and system |
CN104598563A (en) * | 2015-01-08 | 2015-05-06 | 北京京东尚科信息技术有限公司 | High concurrency data storage method and device |
CN105306552A (en) * | 2015-09-30 | 2016-02-03 | 中国科学院计算技术研究所 | Consumption equilibrium method and system based on message queues |
CN107682169A (en) * | 2016-08-02 | 2018-02-09 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus using Kafka collection pocket transmission message |
CN107104822A (en) * | 2017-03-29 | 2017-08-29 | 杭州云纪网络科技有限公司 | Server preparedness processing method, device, storage medium and electronic equipment |
CN108009027A (en) * | 2017-11-23 | 2018-05-08 | 北京百度网讯科技有限公司 | Implementation method, device, equipment and the storage medium of queue message uniformity |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111061550A (en) * | 2019-12-03 | 2020-04-24 | 北京每日优鲜电子商务有限公司 | Task processing method, device, equipment and storage medium |
CN111314423A (en) * | 2020-01-17 | 2020-06-19 | 青梧桐有限责任公司 | MQ degradation processing method and system based on long-rental apartment task queue |
CN113672357A (en) * | 2020-05-15 | 2021-11-19 | 北京沃东天骏信息技术有限公司 | Task scheduling method, device and system |
CN113741797A (en) * | 2020-08-31 | 2021-12-03 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
CN112905335A (en) * | 2021-02-02 | 2021-06-04 | 北京思特奇信息技术股份有限公司 | Switching method for calling multiple sets of system same services and business processing system |
CN112905335B (en) * | 2021-02-02 | 2023-11-10 | 北京思特奇信息技术股份有限公司 | Switching method for calling same service of multiple sets of systems and business processing system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110515741A (en) | A kind of degradation processing method and device based on local task queue | |
CN110825535B (en) | Job scheduling method and system | |
CN110310034A (en) | A kind of service orchestration applied to SaaS, business flow processing method and apparatus | |
CN108733476A (en) | A kind of method and apparatus executing multitask | |
CN110245011A (en) | A kind of method for scheduling task and device | |
CN108897854A (en) | A kind of monitoring method and device of overtime task | |
CN109033001A (en) | Method and apparatus for distributing GPU | |
CN109995801A (en) | A kind of method for message transmission and device | |
CN107844324A (en) | Customer terminal webpage redirects treating method and apparatus | |
CN109976919A (en) | A kind of transmission method and device of message request | |
CN109032796A (en) | A kind of data processing method and device | |
CN110427304A (en) | O&M method, apparatus, electronic equipment and medium for banking system | |
CN109981322A (en) | The method and apparatus of cloud resource management based on label | |
CN110473036A (en) | A kind of method and apparatus generating order number | |
CN109634833A (en) | A kind of Software Defects Predict Methods and device | |
CN1783121B (en) | Method and system for executing design automation | |
CN107463642A (en) | The method and apparatus for lifting Tool for Data Warehouse resource utilization | |
CN110070394A (en) | Data processing method, system, medium and calculating equipment | |
CN109960212A (en) | Task sending method and device | |
CN111984234A (en) | Method and device for processing work order | |
CN110083457A (en) | A kind of data capture method, device and data analysing method, device | |
US20240054451A1 (en) | Inventory information processing method and device | |
CN109814957A (en) | A kind of label addition method and device for IOS system | |
CN112817562A (en) | Service processing method and device | |
CN109428926A (en) | A kind of method and apparatus of scheduler task node |
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 |