CN106487569B - Service message processing method and device - Google Patents

Service message processing method and device Download PDF

Info

Publication number
CN106487569B
CN106487569B CN201510556778.5A CN201510556778A CN106487569B CN 106487569 B CN106487569 B CN 106487569B CN 201510556778 A CN201510556778 A CN 201510556778A CN 106487569 B CN106487569 B CN 106487569B
Authority
CN
China
Prior art keywords
message
service
service message
current
waiting task
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
CN201510556778.5A
Other languages
Chinese (zh)
Other versions
CN106487569A (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.)
Cainiao Smart Logistics Holding Ltd
Original Assignee
Cainiao Smart Logistics Holding Ltd
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 Cainiao Smart Logistics Holding Ltd filed Critical Cainiao Smart Logistics Holding Ltd
Priority to CN201510556778.5A priority Critical patent/CN106487569B/en
Publication of CN106487569A publication Critical patent/CN106487569A/en
Application granted granted Critical
Publication of CN106487569B publication Critical patent/CN106487569B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the application provides a method and a device for processing service messages, which are used for solving the problem that when the quantity of the service messages is large and the arrival according to a set sequence cannot be guaranteed, a large quantity of service messages can be retried, and the stability of a message middleware server is influenced. The method comprises the following steps: acquiring waiting tasks from a waiting task queue, wherein each waiting task is a waiting task created by the first node aiming at the current service message when the first node receives the current service message and determines that the dependency service message of the current service message does not exist in the stored service message; for each waiting task acquired, performing the following operations: if it is determined that the service message stored in the first node contains the dependent service message waiting for the waiting task, the dependent service message is utilized to execute associated service processing on the current service message aiming at the time of creating the waiting task, and the waiting task is deleted.

Description

A kind of service message processing method and device
Technical field
This application involves internet data processing technology field more particularly to a kind of service message processing methods and device.
Background technique
The operation system complicated for one comprising many support systems.For example, this is multiple for e-commerce system Miscellaneous operation system may include merchandise system, transaction system, logistics system, after sale system, operation system, merchant system Etc. support systems.
In order to ensure that the stability of respective support system, each support system to the processing of business are handed over by message Mutual mode carries out.For some support system, the service message of a lot of other support systems is often subscribed to, The existing core support system of these other support systems, and have non-core support system.
According to some service messages (service message being relied on), when executing associated services processing, need using arriving other Service message (relies on service message).It tends not to reach prior to the service message being relied on however, relying on service message, cause Associated services processing can not be executed.For example, for the support system for paying close attention to whole service link, usually according to actual Business order of occurrence handles the service message of whole chain road, it may also be said to be to some service messages in whole business chain Execute associated services processing, but actually due to service message be it is asynchronous, along with message-oriented middleware server has very much, and The arrival of service message the order of arrival desirably it cannot be guaranteed that service message for other support systems subscribed to is bound to.Below It is illustrated by the supply chain document centring system of e-commerce system shown in FIG. 1.
Supply chain document centring system in Fig. 1 contains 4 support systems, be respectively transaction system, logistics ordering system, Warehousing and storage activities system and document centring system;Wherein, document centring system is to pay close attention to the support system of whole service link, is needed Subscribe to the transaction payment message of transaction system generation, the logistics order creation message and warehousing and storage activities that logistics ordering system generates The warehousing and storage activities order creation message that system generates.Transaction system corresponds to 3 message-oriented middleware servers, logistics ordering system pair Answer 2 message-oriented middleware servers, the corresponding 1 message-oriented middleware server of warehousing and storage activities system;Each support system is corresponding Message-oriented middleware server exists usually in the form of cluster, is mainly responsible for the business for generating its corresponding support system Message is forwarded to each purpose system.It is different to the reliability of message and the requirement of timeliness according to the purpose system of forwarding, it can Different resource distributions, reliability and timeliness of the purpose system to message is arranged to corresponding each message-oriented middleware server Demanding, the resource distribution height for being responsible for being forwarded to the message-oriented middleware server of the purpose system is also higher, priority It is correspondingly higher;
In Fig. 1, actual business order of occurrence is: transaction payment → logistics order creation → warehousing and storage activities order creation; Since document centring system is to the storage in transaction this business chain of payment → logistics order creation → warehousing and storage activities order creation Operation order creation message executes associated services processing and needs using transaction payment message and logistics order creation message, therefore, The desired service message order of arrival of document centring system is: transaction payment message → logistics order creation message → warehousing and storage activities Order creation message;
But in fact, the priority difference and business due to each message-oriented middleware server of transmission service message disappear It ceases the specific of itself to determine, the transaction payment that transaction system, logistics system and warehousing and storage activities system are generated for same transaction Sequence when message, logistics order creation message and warehousing and storage activities order creation message arrival document centring system may are as follows: object Flow order creation message → warehousing and storage activities order creation message → transaction payment message, warehousing and storage activities order creation message → logistics Order creation message → transaction payment message or transaction payment message → warehousing and storage activities order creation message → logistics order wound Build message etc..
In order to ensure service message can service message order of arrival desirably reach, and then disappear to the business being relied on Breath executes associated services processing, as shown in Figure 2 to the processing method of service message in the prior art, comprising the following steps:
Step 201: receiving current business message;
For the supply chain document centring system shown in Fig. 1, it is assumed here that the current service message received is Warehousing and storage activities order creation message, the dependence service message of the warehousing and storage activities order creation message are transaction payment message and logistics Order creation message, and receive transaction payment message and logistics order creation message not yet before;
Step 202: separate traffic processing is carried out to the current service message;
Here the purpose that step 202 carries out separate traffic processing is, is to be suitble to originally be located in by current business Message Processing The service message of reason.
Step 203: current business message is saved in can be in the storage equipment of persistence;
Here, the example in step 201 is continued to use, the warehousing and storage activities order creation message received is saved in storage equipment In;
Step 204: judging whether the current service message needs to rely on service message;If the determination result is YES, then it executes Step 205;If judging result be it is no, terminate.
The example of step 203 is continued to use, judges that warehousing and storage activities order creation message needs to rely on service message here;
Step 205: judging that the dependence service message of the current service message whether there is;If the determination result is YES, then it holds Row step 206;If judging result be it is no, then follow the steps 207;
The example of step 204 is continued to use, here due to receiving transaction payment message and logistics order creation message not yet, Therefore, there is no store transaction payment message and logistics order creation message in above-mentioned storage equipment, namely judge that storage is made The dependence service message of industry order creation message is not present, and executes step 207;
Step 206: using the dependence service message of the current service message, associated services being executed to the current service message Processing.
Step 207: trying again later and disappear to the message-oriented middleware server transmission processing failure for sending the current service message Breath, and the operation that rollback executes the current service message.
The example of step 205 is continued to use, here, document centring system sends processing failure to warehousing and storage activities system and tries again later Message deletes the warehousing and storage activities order creation message of storage to storage equipment in step 203.
Generally, if the dependence service message that the above method is the current business message received does not reach, The current service message will be rolled back.
Above-mentioned service message processing method can guarantee the service message order of arrival that service message is bound to desirably It reaches, allows to be associated business processing to the service message being relied on.However, defect existing for this method is also aobvious and easy See, that is, when service message amount is big, and cannot be guaranteed to reach according to setting sequence, a large amount of service message can be retried. Bulk deposition between this will will lead to service message in the message in part server, and directly affect message-oriented middleware server Stability.If what the message-oriented middleware server was responsible for is the forwarding of the service message of core support system, this will be right The processing of business causes even more serious influence.
Summary of the invention
The embodiment of the present application provides a kind of service message processing method and device, of the existing technology works as industry to solve When being engaged in size of message greatly and cannot be guaranteed to reach according to setting sequence, a large amount of service message can be retried, and influence message-oriented middleware The problem of stability of server.
A kind of service message processing method, comprising:
Receive and save current business message;
If it is determined that the dependence service message of the current service message is not present in the service message saved, then it is current for this Service message creates waiting task, wherein the dependence service message of the current service message includes holding to the current service message When the processing of row associated services, service message to be used is needed, the waiting task of creation is for waiting the current service message Dependence service message;
The waiting task of creation is written to and is waited in task queue, and indicates at least one second node from waiting Waiting task, and each waiting task for acquisition are obtained in task queue, however, it is determined that the business that first node saves disappears There are the dependence service messages that the waiting task dispatching waits in breath, then utilize the dependence service message, when to creating the waiting task Targeted current business message executes associated services processing.
A kind of service message processing method, comprising:
Waiting task is obtained in task queue from waiting, wherein each waiting task is that first node receives current industry It is engaged in message, and determines in the service message saved, it is current for this there is no when the dependence service message of the current service message The waiting task of service message creation, the dependence service message of the current service message includes executing pass to the current service message When joining business processing, need service message to be used, the waiting task of creation be used to wait the current service message according to Rely service message, each the current business message received is added to the service message of the preservation by the first node In;
For each waiting task of acquisition, following operation is executed:
If it is determined that there are the dependence service messages that the waiting task dispatching waits for, then sharp in the service message that first node saves With the dependence service message, associated services processing is executed to current business message targeted when creating the waiting task, and is deleted Except the waiting task.
A kind of service message processing unit, comprising:
Receiving module, for receiving current business message;
Preserving module, for saving received current business message;
Creation module, for if it is determined that the dependence business in the service message saved there is no the current service message disappears Breath then creates waiting task for the current service message, wherein the dependence service message of the current service message includes to this When current business message executes associated services processing, service message to be used is needed, the waiting task of creation is for waiting The dependence service message of the current service message;
Writing module waits in task queue for the waiting task of creation to be written to, and indicates at least one Second node obtains waiting task, and each waiting task for acquisition from waiting task queue, however, it is determined that preservation There are the dependence service messages that the waiting task dispatching waits in service message, then utilize the dependence service message, to the creation waiting Targeted current business message executes associated services processing when task.
A kind of service message processing unit, comprising:
Module is obtained, for obtaining waiting task from waiting task queue, wherein each waiting task is first node Current business message is received, and is determined in the service message saved, there is no the dependence service messages of the current service message When, for the waiting task that the current service message creates, the dependence service message of the current service message includes current to this When service message executes associated services processing, service message to be used is needed, the waiting task of creation is deserved for waiting Each the current business message received is added to the guarantor by the dependence service message of preceding service message, the first node In the service message deposited;
Execution module, for executing following operation: if it is determined that first node saved for each waiting task obtained In service message, there are the dependence service messages that the waiting task dispatching waits for, then utilize the dependence service message, to the creation waiting Targeted current business message executes associated services processing when task, and deletes the waiting task.
In the scheme of the embodiment of the present application, current business message is received and saved, in determining the service message saved There is no when the dependence service message of the current service message, waiting task is created for the current service message, by creation Waiting task, which is written to, to be waited in task queue, and indicates that at least one second node is appointed for the waiting waited in task queue Business, in the service message of preservation exist wait task dispatching when dependence service message when, using the dependence service message, to wound It builds current business message targeted when the waiting task and executes associated services processing.Since current business message is being not present When relying on service message, rollback is not carried out to the current service message and retries operation, create waiting task, waiting according to Rely the arrival of service message and then be associated business processing, therefore, when service message amount is big and cannot be guaranteed according to setting When sequence reaches, a large amount of service message will not be retried, service message will not due to retrying in the message between in part server Bulk deposition, improve the stability of message-oriented middleware server.
Detailed description of the invention
Fig. 1 is the schematic diagram for the supply chain document centring system that the application background technique provides;
Fig. 2 is the service message processing method flow chart that the application background technique provides;
Fig. 3 is the service message processing method flow chart that the embodiment of the present application one provides;
Fig. 4 is the service message processing method flow chart that the embodiment of the present application two provides;
Fig. 5 is the structural schematic diagram for the service message processing unit that the embodiment of the present application three provides;
Fig. 6 is the structural schematic diagram for the service message processing unit that the embodiment of the present application four provides.
Specific embodiment
In the scheme of the embodiment of the present application, first node receives and saves current business message, is determining the industry saved When the dependence service message of the current service message being not present in message of being engaged in, waiting task is created for the current service message, The waiting task of creation is written to and is waited in task queue, and indicates at least one second node in waiting task queue Waiting task, in the service message of preservation exist wait task dispatching when dependence service message when, utilize the dependence business Message executes associated services processing to current business message targeted when creating the waiting task.Due to being not present currently When the dependence service message of service message, rollback is not carried out to the current service message and retry operation, creation waits Task waits the arrival for relying on service message and then is associated business processing, therefore, when service message amount is big and cannot When guaranteeing to reach according to setting sequence, a large amount of service message will not be retried, and service message will not be due to retrying in the message Between bulk deposition in part server, compared with the prior art for, improve the stability of message-oriented middleware server;Meanwhile In the scheme of the embodiment of the present application, due to first node indicate at least one second node wait rely on service message arrival it Afterwards, waiting task is handled, namely asynchronous process is carried out to the task of waiting, rather than first node is handled, this just makes In the scheme of the embodiment of the present application first node to the processing speed of received current business message and no less than existing skill The processing speed of art.
In addition, the node (second node, first node, distributed timing task node) in the embodiment of the present application can be Refer to the program that one group of logic is completed according to distributed protocol.In specific engineering project, node here is typically referred to The process of one operating system.Here first node, distributed timing task node and at least one second node can position In on same server, can also be located on different servers.
Below in conjunction with Figure of description, preferred embodiment of the present invention will be described, it should be understood that described herein Preferred embodiment is only for the purpose of illustrating and explaining the present invention and is not intended to limit the present invention.And in the absence of conflict, this Shen Please in embodiment and embodiment in feature can be combined with each other.
Embodiment one
As shown in figure 3, the flow chart of its service message processing method provided for the embodiment of the present application one, including following step It is rapid:
Step 301: first node receives current business message;
Here first node is received can be the service message from each operation system, between these operation systems usually It is that there is certain business dependence;
For example, first node here can be to feel concerned about in document for supply chain document centring system shown in Fig. 1 First node in system receives the transaction payment generated from transaction system, logistics order creation system and warehousing and storage activities system Message, logistics order creation message and storage order creation message.Logistics order creation system is to create to trade in transaction system After order, the logistics order created on the basis of the trade order, and warehousing and storage activities system is in logistics order creation system The warehousing and storage activities order created on the basis of the logistics order of creation.
Here the service message that first node current time receives is known as current business message;
Step 302: first node saves current business message;
First node saves each current business message received, the service message that can be saved;
Here, processing can also be extracted to service message, extracts the business datum in service message, save business Data;
It, will not be due to the dependence service message of the current service message is not present after first node saves current business message It is deleted;
Here current business message, can for without dependence service message current business message, or have according to Rely the current business message of service message.
Example shown in step 301 is continued to use, if what is received in step 301 is transaction payment message, transaction payment Message is the service message without relying on service message;If what is received in step 301 is warehousing and storage activities order creation message, Then the warehousing order creation message is the service message for having and relying on service message, because disappearing to warehousing and storage activities order creation Breath executes associated services processing and needs using transaction payment message and logistics order creation message.
It can produce many typically for a business chain because the business object of first business in business chain is different String message;In order to distinguish different service messages, a service identification can be arranged to each service message, be used to unique identification The service message, when the service message has and relies on service message, the service identification of each service message relied on It carries in this service message, in order to subsequent lookup;One can also be arranged to a string of message to identify, in the string message Each service message carry the mark and the type of service of itself (it is assumed that in the string message each message message class Type is different), when the service message has dependence service message, the type of service of each service message relied on is also carried In this service message, in order to subsequent lookup;
Such as: it trades for one, corresponding transaction payment message, logistics order creation message and warehousing and storage activities order creation This string of message of message;Under multiple transaction, multiple transaction payment messages, multiple logistics order creation message and more can be generated A transaction ID can be arranged to transaction payment message, to warehousing and storage activities order creation in a warehousing and storage activities order creation message A warehousing and storage activities order note identification is arranged in message, which is carried in warehousing and storage activities order creation message, And transaction ID and logistics order note identification are also carried.Or one Transaction Identification Number of setting, the lower transaction generated of a transaction are paid Money message, logistics order creation message and warehousing and storage activities order creation message carry the Transaction Identification Number, and in transaction payment message Middle carrying transaction business type carries logistics order type in logistics order creation message, disappears in warehousing and storage activities order creation Warehousing and storage activities order type is carried in breath;
Preferably, carry the first service identification in current business message, or carry the first service identification and at least One the second service identification, wherein the first service identification is the service identification of the current service message, and the second service identification is should The service identification for the service message for including in the dependence service message of current business message;
Here the number for the second service identification that current business message carries is the dependence business of the current service message The number for the service message for including in message, it is subsequent to can use second service identification, to find the current service message Dependence service message.
In addition, on the basis of above-mentioned preferable scheme, in order to improve the lookup that subsequent second node searches service message The identical service message of type of service can be stored in same tables of data by speed, namely preferably, current business message In also carry the first type of service or the first type of service and at least one second type of service, wherein first industry Service type is the type of service of the current service message, and second type of service is that the dependence business of the current service message disappears The type of service for the service message for including in breath;
First node saves current business message in the following manner:
The first type of service that first node includes according to received current business message, by receive each is current Service message is added in the service message of the preservation, wherein the identical service message of type of service is stored in same number According in table;
Step 303: first node judges whether the current business message has dependence service message;If judging result is It is no, then terminate;If the determination result is YES, 304 are thened follow the steps;
Due to not needing to carry out the current service message when the current business message does not have and relies on service message Processing, therefore, terminates to terminate the current service message treatment process here, can be directed to the current business message of subsequent time Execute above-mentioned steps 301.
Continue to use the example in step 301, it is assumed that the current business message sink to be transaction payment message, then this step It is just ended processing in rapid 303.
The second service identification whether can be carried according to current business message specifically whether to judge the current service message With dependence service message;If carrying the second service identification, it is determined that have and relies on service message, it is on the contrary, it is determined that not have There is dependence service message;And the current service message not identical in the type of service of each service message carries the first type of service When, it can also judge whether the current service message has dependence service message according to the first type of service;If the first business Type is identical as having the dependence type of service of service message, it is determined that and have and relies on service message, it is on the contrary, it is determined that not have Rely on service message;
Such as: when current business message is transaction payment message, the service identification carried does not have other than transaction ID Have and carry other service identifications, therefore, it is possible to judge that it does not have dependence service message specifically;It is that storage is made in current business message When industry order creation message, for the service identification carried other than warehousing and storage activities order note identification, there are also transaction IDs and logistics to order Therefore single mark has and relies on service message.
Step 304: in the service message that first node judgement saves, if deposit the dependence business of service message in this prior Message;If judging result be it is no, then follow the steps 305;If the determination result is YES, 306 are thened follow the steps;
Specifically, every one second industry can be directed to when current business message carries at least one second service identification Business mark, searches in the service message of preservation and disappears with the presence or absence of the first service identification business identical with second service identification Breath;If finding, it is determined that in the service message of preservation, the dependence service message of service message in this prior is deposited, conversely, then It determines in the service message saved, there is no the dependence service messages of the current service message.
Carry at least one second type of service in received current business message, and first node is by current business When message is added in the service message of the preservation according to the first type of service of carrying, lookup at this time can also be needle To each second service identification that current business message carries, corresponding type of service and second service identification pair are first searched The identical tables of data of the second type of service answered;Then again in the tables of data found, the first service identification for including is searched Service message identical with second service identification.
Step 305: creating waiting task for the current service message;Step 307 is executed later;
Wherein, the dependence service message of the current service message includes executing associated services processing to the current service message When, need service message to be used;
It is basis that the number of service message to be used is needed when executing associated services processing to the current service message here It is actually needed to determine, can be one, or multiple;
Here the waiting task created is used to wait the dependence service message of the current service message.
In this step 305, creation time parameter can also be set for waiting task, it is subsequent by creation time to facilitate Sequencing handles waiting task.
Preferably, carry the first service identification in current business message, or carry the first service identification and extremely When few second service identification, first node, which can be waited by following two step for the current service message creation, appoints Business:
Step 1: first node is using the second service identification of the current service message and the first service identification as this etc. Waiting conditional parameter to task;
The first type of service or the first type of service and at least one second industry are also carried in current business message When service type, the first step be may particularly include: the first service identification that first node carries the current service message, first The waiting conditional parameter of type of service, the second service identification and corresponding second type of service as the waiting task;
Step 2: creating waiting task for the current service message using the waiting conditional parameter.
Here using the first service identification, the first type of service, the second service identification and the second type of service as waiting item Part parameter, in order to search the dependence service message for waiting task dispatching to wait for convenient for subsequent.
In addition, can also be using the growth data of current business message as the extension of waiting task when creating waiting task Data parameters, facilitate it is subsequent after receiving the dependence business datum of waiting, by current business message business datum, rely on Business datum and the data of activating business in service message are associated business processing, to meet different business need It asks.
Step 306: the service message relied on it the current service message is associated business processing.
Here the service message that current business message is relied on it is associated business processing essence is according to business need It wants, the business datum in service message that the business datum in current business message is relied on it is associated business processing.
When being associated business processing here, the data of activating business of the current service message can also be added, it will be current Business datum in service message, the business datum in dependence service message and the data of activating business are associated business Processing, to meet different business demands.
For example, for shown in Fig. 1, it is assumed that be the order messages that will store in a warehouse, with transaction payment message and logistics order messages It is associated business processing, then can be the type according to transaction amount, tradable commodity in transaction payment message, transaction at this time The weight of commodity calculates whether logistics order needs to collect express fee, and collect the amount of money of express fee, and thus determines The job priority of warehousing and storage activities order.
Certainly, it is only a citing here, which kind of is specifically carried out and how to be associated business processing to be according to business Itself and actual demand progress, different business and different demands are associated the type and method and different of business processing It is fixed identical, since this is not technical problems to be solved in this application, this is no longer described in detail here.
Step 307: the waiting task of creation is written to and waits in task queue by first node, and indicates at least one A second node obtains waiting task, and each waiting task for acquisition from waiting task queue, however, it is determined that first There are the dependence service messages that the waiting task dispatching waits in the service message that node saves, then utilize the dependence service message, right It creates current business message targeted when the waiting task and executes associated services processing.
Here waiting task queue can be first node creation, and it is (such as distributed fixed to be also possible to other nodes When task node) creation.
Here first node instruction second node handles waiting task, processing at this time be to waiting task into Line asynchronous processing, first node continue the reception and preservation of current business message, over time, wait task dispatching To dependence service message may can be received and be added to by first node in the service message of preservation, at this point, second When node is handled for the waiting task, dependence business can be inquired from the service message of current or newest preservation Message, and then service message targeted when creating the waiting task and the dependence service message inquired are associated at business Reason.
Embodiment two
As shown in figure 4, the flow chart of its service message processing method provided for the embodiment of the present application two, including following step It is rapid:
Step 401: second node obtains waiting task from waiting task queue;Step 402 is executed later;
Wherein, each waiting task is that first node receives current business message, and determines in the service message saved, There is no the waiting tasks when dependence service message of the current service message, created for the current service message;
The dependence service message of the current service message includes when executing associated services processing to the current service message, needing Service message to be used;
The waiting task of creation is used to wait the dependence service message of the current service message;
Each the current business message received is added in the service message of the preservation by the first node;
Detailed description has been carried out in creation about the task of waiting in example 1, and which is not described herein again.
The waiting task that the second node obtains can be second node and actively obtain to wait from first node and appoints Business is also possible to the waiting task that second node is obtained from first node by the timing of distributed timing task node;
The waiting task queue that above-mentioned distributed timing task node can create first node is periodically scanned, often It is secondary that a collection of waiting task is taken out from the waiting task queue, the waiting task of taking-up is distributed to multiple second nodes.It sweeps The time interval retouched can be determined according to the service message maximum delay duration of operation system, for example, time interval is arranged For the setting multiple of service message maximum delay duration;For e-commerce system, the delay of ordinary business practice message is all 1 Within second, the time interval of scanning be can be set to 15 seconds.
Here second node obtains waiting task and the subsequent process handled waiting task and first node The preservation service message of current business message and subsequent execution is received, creation waits a series for the treatment of processes of task dispatching, can be with It is independent from each other;Second node and first node respectively carry out the treatment process of itself, and the two can be while carry out, It can not be while carrying out;
Step 402: second node judges whether there are also the tasks of waiting in the waiting task obtained, if so, thening follow the steps 403;If it is not, then terminating.
Step 403: second node takes out a waiting task from the waiting task of acquisition, executes step 404 later;
When size of message is big, the waiting task of creation is more, and the number for the waiting task that second node obtains here is usual To be multiple, therefore, it is necessary to take out each waiting task one by one from the waiting task of acquisition, for the waiting task of the taking-up, Step 404 is executed to step 406;
Here this waiting task taken out is usually the different waiting task of waiting task taken out with the last time, is removed Non- remains next waiting task.
Usually sequentially occur in view of each business in a business chain, service message is according to its corresponding business Actually occur time generation, the dependence service message of the service message is also according to its corresponding business when actually occurring Between generate, and first node is first to create waiting task for the service message first reached, this allows for the waiting first created The time of what task dispatching waited for rely on service message reaches first node often, earlier than the dependence industry that waits for of waiting task dispatching of rear creation The time of the arrival first node for message of being engaged in;In order to handle as early as possible waiting task, the dependence industry that waits for of task dispatching will be waited Business message and targeted current business message is associated business processing when creating the waiting task, need to first create etc. It is first handled to task, preferably, the waiting task has creation time parameter;At this point, this step 303 specifically includes:
The creation time that the second node is indicated according to creation time parameter is by the sequence after arriving first, from the waiting of acquisition A waiting task is taken out in task.
Step 404: in the service message for judging first node preservation, if there are the dependences that the waiting task dispatching of taking-up waits for Service message;If so, thening follow the steps 405;If it is not, thening follow the steps 406;
Here the business that first node saves can be judged according to the waiting conditional parameter being arranged when creating waiting task In message, if there are the dependence service messages that the waiting task dispatching of taking-up waits for.Wait conditional parameter that can be arranged to rely on industry The information such as the service identification for message of being engaged in and type of service.
The first service identification and at least one second service identification are carried in current business message, creation When conditional parameter being waited to include the second service identification that the current service message carries of the waiting task, in this step 404 In, second node can be specifically determined by following two step in the service message that first node saves, if there are these etc. The dependence service message waited for task dispatching:
Step 1): in the service message that first node saves, for including in the waiting conditional parameter of the waiting task Every one second service identification, search the first service identification for including service message identical with second service identification;
Step 2): it if for every one second service identification for including in the waiting conditional parameter of the waiting task, searches To comprising the first service identification service message identical with second service identification, it is determined that exist in the service message of preservation The dependence service message that the waiting task dispatching waits for;It is on the contrary, it is determined that be waited in the service message of preservation there is no the waiting task dispatching Dependence service message.
Preferably, if also carrying the first type of service and the second type of service in current business message, the waiting item Part parameter also includes the first type of service and the second type of service that the current service message carries;The service message of the preservation In, when the identical service message of the first type of service of carrying is stored in same tables of data, above-mentioned steps 1), specific to wrap It includes:
It is identical to search the second type of service for including in corresponding type of service and the waiting conditional parameter of the waiting task Tables of data;
In the tables of data found, search in the waiting conditional parameter for the first service identification and waiting task for including The identical service message of the second service identification for including.
Step 405: second node utilizes the dependence service message, targeted current business when to the creation waiting task Message executes associated services processing, and deletes the waiting task;Go to step 402 later;
Step 406: in the waiting task that second node obtains waiting task deposit;Go to step 403 later.
Since the dependence service message for the waiting task taken out is not present in the service message of first node preservation here, because This, needs to place back in the waiting task in the waiting task of acquisition, and task must be also waited in the waiting task of acquisition, Therefore, 403 are gone to step without going to step 402, but.
In the scheme of above-described embodiment one and embodiment two, the current business message can with but be not limited to logistics and disappear Breath.Here logistics message is broad sense, including various information relevant to logistics, these information are by ordering in logistics progress Goods, receive, stock control, delivery, the function such as dispatching and recycling organically link together, keep entire logistics activity smooth It carries out.For example, the transaction payment message generated in supply chain document centring system shown in Fig. 1, logistics order creation message It is related to logistics to warehousing and storage activities order creation message, it can be described as logistics information.
When current business message is logistics message, the scheme of the present embodiment one is to apply under logistics business scene Logistics message treatment method, when receiving a logistics message, since the dependence service message in the logistics message does not arrive Up to when, rollback is not carried out to the logistics message and retries operation, creation waiting task waits the dependence of the logistics message The arrival of service message and then associated services processing is executed to the logistics message, therefore, when logistics size of message is big and cannot protect Card according to setting sequence reach when, a large amount of logistics message will not be retried, logistics message will not due to retrying in the message between Bulk deposition in part server improves the stability of message-oriented middleware server.
For example, for supply chain document centring system shown in Fig. 1, according to the scheme of the embodiment of the present application one, it is assumed that At the t1 moment, first node has received the warehousing and storage activities order creation message that service identification is A_3, warehousing and storage activities order wound The logistics business for building in message the transaction payment message and logistics order creation message that carry its dependence is identified as A_2 and A_1, At this point, determining the logistics message for not having storage service to be identified as A_2 and A_1 in the logistics message saved, the received industry is saved Business is identified as the warehousing and storage activities order creation message of A_3, and creates the logistics message that A_2 and A_1 is identified as latency services Waiting task T1, write-in wait task queue;
At the t2 moment, first node, which receives the logistics order creation message that service identification is B_2 and is saved in logistics, to disappear In breath;
At the t3 moment, first node receives the transaction payment message that service identification is B_1 and is saved in logistics message;
At the t4 moment, first node, which receives the logistics order creation message that service identification is A_2 and is saved in logistics, to disappear In breath;
At the t5 moment, first node, which receives the logistics order creation message that service identification is A_1 and is saved in logistics, to disappear In breath;
At the t6 moment, first node receives the warehousing and storage activities order creation message that service identification is B_3, the warehousing and storage activities Order creation message also carries service identification B_1 and B_2, at this point, first node determines that there are industry in the logistics message saved The transaction payment message and logistics order creation message of business mark B_1 and B_2;It is paid using the transaction of service identification B_1 and B_2 Money message and logistics order creation message execute at business association the warehousing and storage activities order creation message that service identification is B_3 Reason;
At the same time, at the t6 moment, second node searches object from waiting acquisition T1 task in task queue and being handled There are transaction payment messages and logistics order creation message that service identification is A_2 and A_1 in flow message;Disappeared using what is found Breath executes business association processing to the warehousing and storage activities order creation message that service identification is A_3;
By the above process as it can be seen that in respect to the background art according to practical business order of occurrence execute association process industry Business Message Processing scheme, the service message that t1, t2, t4, t6 reception arrive is not to corresponding message-oriented middleware server It sending processing failure and tries again later message, corresponding message-oriented middleware server, which does not both need to receive this, unsuccessfully retries message, It does not need to continue the message to save (so as to retransmission later), this, which allows for a large amount of message, will not be stacked on accordingly Message-oriented middleware server in, message-oriented middleware server only needs to be implemented forwarding task, and then improves in message Between part server stability.
Embodiment three
Corresponding with embodiment one, the embodiment of the present application three provides a kind of service message processing unit, the service message Processing unit has the function of the first node in above-described embodiment one, as shown in figure 5, what it was provided for the embodiment of the present application three The structural schematic diagram of service message processing unit, comprising: receiving module 51, preserving module 52, creation module 53 and writing module 54;Wherein:
Receiving module 51, for receiving current business message;
Preserving module 52, for saving received current business message;
Creation module 53, for if it is determined that the dependence business in the service message saved there is no the current service message disappears Breath then creates waiting task for the current service message, wherein the dependence service message of the current service message includes to this When current business message executes associated services processing, service message to be used is needed, the waiting task of creation is for waiting The dependence service message of the current service message;
Writing module 54 waits in task queue for the waiting task of creation to be written to, and indicates at least one A second node obtains waiting task, and each waiting task for acquisition from waiting task queue, however, it is determined that first There are the dependence service messages that the waiting task dispatching waits in the service message that node saves, then utilize the dependence service message, right It creates current business message targeted when the waiting task and executes associated services processing.
Preferably, the current business message is logistics message.
Preferably, carry the first service identification in current business message, or carry the first service identification and at least One the second service identification, wherein the first service identification is the service identification of the current service message, and the second service identification is should The service identification for the service message for including in the dependence service message of current business message;
The creation module 53 is appointed specifically for the second service identification for carrying the current service message as the waiting The waiting conditional parameter of business;Using the waiting conditional parameter, waiting task is created for the current service message.
Preferably, also carrying the first type of service or the first type of service and at least one in current business message Second type of service, wherein the first type of service is the type of service of the current service message, and the second type of service is that this is current The type of service for the service message for including in the dependence service message of service message;
The preserving module 52, specifically for the first type of service according to carrying, each the current industry that will be received Business message is added in the service message of the preservation, wherein the identical service message of type of service is stored in same data In table;
The creation module 53, specifically for the second service identification for carrying the current service message and carry second Waiting conditional parameter of the type of service as the waiting task.
By the principle and previous embodiment one of the solved problem of service message processing unit and the business of embodiment two Message treatment method is similar, therefore the implementation of the service message processing unit may refer to previous embodiment one and embodiment two The implementation of service message processing method, overlaps will not be repeated.
Example IV
Corresponding with embodiment two, the embodiment of the present application four provides a kind of service message processing unit, the service message Processing unit has the function of the second node in above-described embodiment two, as shown in fig. 6, what it was provided for the embodiment of the present application four The structural schematic diagram of service message processing unit, comprising:, comprising: obtain module 61 and execution module 62;Wherein:
Module 61 is obtained, for obtaining waiting task from waiting task queue, wherein each waiting task is first segment Point receives current business message, and determines in the service message saved, and there is no the dependence business of the current service message to disappear When breath, for the waiting task that the current service message creates, the dependence service message of the current service message includes to deserving When preceding service message executes associated services processing, service message to be used is needed, the waiting task of creation is for waiting this Each the current business message received is added to described by the dependence service message of current business message, the first node In the service message of preservation;
Execution module 62, for executing following operation: if it is determined that first node is saved for each waiting task obtained Service message in, there are the dependence service messages that the waiting task dispatching waits for, then utilize the dependence service message, to create this etc. Targeted current business message executes associated services processing when task, and deletes the waiting task.
Preferably, the current business message is logistics message.
Preferably, the waiting task has creation time parameter;
The execution module 62, specifically for the creation time that is indicated according to creation time parameter by the sequence after arriving first, For each waiting task of acquisition, the operation is executed.
Preferably, carrying the first service identification and at least one second service identification in current business message, wherein the One service identification is the service identification of the current service message, and the second service identification is that the dependence business of the current service message disappears The service identification for the service message for including in breath;The waiting task of creation, which has, waits conditional parameter, waiting condition ginseng The second service identification that number is carried comprising the current service message;
The execution module 62, specifically in the service message that first node saves, for the waiting task etc. Every one second service identification to include in conditional parameter, the first service identification for searching carrying are identical as second service identification Service message;If being directed to every one second service identification, the first service identification and second service identification for including are found Identical service message, it is determined that there are the dependence service messages that the waiting task dispatching waits in the service message of preservation.
Preferably, also carrying the first type of service and at least one second type of service in current business message, wherein First type of service is the type of service of the current service message, and the second type of service is the dependence business of the current service message The type of service for the service message for including in message;At least one described second service identification and at least one described second business Type is corresponding, and the waiting conditional parameter also includes the second type of service that the current service message carries;The preservation In service message, the identical service message of the first type of service of carrying is stored in same tables of data;
The execution module 62, specifically in the service message that first node saves, for the waiting task etc. Every one second service identification to include in conditional parameter executes following operation: searching corresponding type of service and second industry The identical tables of data of corresponding second type of service of business mark;In the tables of data found, the first business mark for including is searched Know service message identical with second service identification.
By the principle and previous embodiment one of the solved problem of service message processing unit and the business of embodiment two Message treatment method is similar, therefore the implementation of the service message processing unit may refer to previous embodiment one and embodiment two The implementation of service message processing method, overlaps will not be repeated.
Through the above description of the embodiments, those skilled in the art can be understood that the embodiment of the present invention The mode of necessary general hardware platform can also be added to realize by software by hardware realization.Based on this understanding, The technical solution of the embodiment of the present invention can be embodied in the form of software products, which can store non-at one In volatile storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.), including some instructions are used so that a computer Equipment (can be personal computer, server or the network equipment etc.) executes method described in each embodiment of the present invention.
It will be appreciated by those skilled in the art that attached drawing is the schematic diagram of a preferred embodiment, module or stream in attached drawing Journey is not necessarily implemented necessary to the present invention.
It will be appreciated by those skilled in the art that the module in embodiment in terminal can describe to be distributed according to embodiment In the terminal of embodiment, corresponding change can also be carried out and be located in one or more terminals different from the present embodiment.It is above-mentioned The module of embodiment can be merged into a module, can also be further split into multiple submodule.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (11)

1. a kind of service message processing method characterized by comprising
Receive and save current business message;
If it is determined that the dependence service message of the current service message is not present in the service message saved, then the current business is directed to Message establishing waits task, wherein the dependence service message of the current service message includes executing pass to the current service message When joining business processing, need service message to be used, the waiting task of creation be used to wait the current service message according to Rely service message;
The waiting task of creation is written to and is waited in task queue, and indicates at least one second node from waiting task Waiting task, and each waiting task for acquisition are obtained in queue, however, it is determined that there are these etc. in the service message of preservation To the dependence service message that task dispatching waits for, then the dependence service message is utilized, to targeted current when creating the waiting task Service message executes associated services processing.
2. the method as described in claim 1, which is characterized in that the current business message is logistics message.
3. the method as described in claim 1, which is characterized in that the first service identification is carried in current business message, or Carry the first service identification and at least one second service identification, wherein the first service identification is the current service message Service identification, the second service identification are the business mark for the service message for including in the dependence service message of the current service message Know;
Waiting task is created for the current service message in the following manner:
Using the second service identification carried in the current service message as the waiting conditional parameter of the waiting task;
Using the waiting conditional parameter, waiting task is created for the current service message.
4. method as claimed in claim 3, which is characterized in that the first type of service is also carried in current business message, or The first type of service of person and at least one second type of service, wherein the first type of service is the business of the current service message Type, the second type of service are the type of service for the service message for including in the dependence service message of the current service message;
Current business message is saved in the following manner:
According to the first type of service of carrying, the business that each the current business message received is added to the preservation is disappeared In breath, wherein the identical service message of type of service is stored in same tables of data;
Using the second service identification of the current service message as the waiting conditional parameter of the waiting task, specifically include:
The second service identification that the current service message is carried and the second type of service carried as the waiting task etc. To conditional parameter.
5. a kind of service message processing method characterized by comprising
Waiting task is obtained in task queue from waiting, wherein each waiting task is that first node receives current business and disappears Breath, and determine in the service message saved, there is no when the dependence service message of the current service message, for the current business The waiting task of message establishing, the dependence service message of the current service message include executing association industry to the current service message When business processing, service message to be used is needed, the waiting task of creation is used to wait the dependence industry of the current service message Each the current business message received is added in the service message of the preservation by business message, the first node;
For each waiting task of acquisition, following operation is executed:
If it is determined that there are the dependence service messages that the waiting task dispatching waits in the service message that first node saves, then utilizing should Service message is relied on, associated services processing is executed to current business message targeted when creating the waiting task, and deleting should Waiting task.
6. method as claimed in claim 5, which is characterized in that the current business message is logistics message.
7. method as claimed in claim 5, which is characterized in that the waiting task has creation time parameter;
In the following manner for each waiting task obtained, the operation is executed:
It is executed by the sequence after arriving first for each waiting task of acquisition according to the creation time of creation time parameter instruction The operation.
8. method as claimed in claim 5, which is characterized in that carry the first service identification and at least in current business message One the second service identification, wherein the first service identification is the service identification of the current service message, and the second service identification is should The service identification for the service message for including in the dependence service message of current business message;Creation the waiting task have etc. To conditional parameter, which includes the second service identification that the current service message carries;
In the service message for determining first node preservation in the following manner, the dependence business waited for there are the waiting task dispatching disappears Breath:
In the service message that first node saves, for every one second industry for including in the waiting conditional parameter of the waiting task Business mark, searches the first service identification service message identical with second service identification of carrying;
If being directed to every one second service identification, the first service identification for including industry identical with second service identification is found Business message, it is determined that there are the dependence service messages that the waiting task dispatching waits in the service message of preservation.
9. method according to claim 8, which is characterized in that also carry the first type of service and extremely in current business message Few second type of service, wherein the first type of service is the type of service of the current service message, and the second type of service is The type of service for the service message for including in the dependence service message of the current service message;At least one described second business mark Knowledge is corresponding at least one described second type of service, and the waiting conditional parameter also includes that the current service message carries Second type of service;In the service message of the preservation, the identical service message of the first type of service of carrying is stored in same It opens in tables of data;
In the service message that first node saves, for every one second industry for including in the waiting conditional parameter of the waiting task Business mark, searches the first service identification service message identical with second service identification of carrying, specifically includes:
In the service message that first node saves, for every one second industry for including in the waiting conditional parameter of the waiting task Business mark executes following operation:
Search the identical tables of data of corresponding type of service the second type of service corresponding with second service identification;
In the tables of data found, the first service identification for including service message identical with second service identification is searched.
10. a kind of service message processing unit characterized by comprising
Receiving module, for receiving current business message;
Preserving module, for saving received current business message;
Creation module, for if it is determined that the dependence service message of the current service message is not present in the service message saved, then Waiting task is created for the current service message, wherein the dependence service message of the current service message includes current to this When service message executes associated services processing, service message to be used is needed, the waiting task of creation is deserved for waiting The dependence service message of preceding service message;
Writing module, for by creation the waiting task be written to wait task queue in, and indicate at least one second Node obtains waiting task, and each waiting task for acquisition from waiting task queue, however, it is determined that first node is protected There are the dependence service messages that the waiting task dispatching waits in the service message deposited, then utilize the dependence service message, should to creation Targeted current business message executes associated services processing when waiting task.
11. a kind of service message processing unit characterized by comprising
Module is obtained, for obtaining waiting task from waiting task queue, wherein each waiting task is that first node receives To current business message, and determine in the service message saved, there is no when the dependence service message of the current service message, needle To the waiting task that the current service message creates, the dependence service message of the current service message includes disappearing to the current business When breath executes associated services processing, service message to be used is needed, the waiting task of creation is for waiting the current business Each the current business message received is added to the industry of the preservation by the dependence service message of message, the first node In message of being engaged in;
Execution module, for executing following operation: if it is determined that the business that first node saves for each waiting task obtained In message, there are the dependence service messages that the waiting task dispatching waits for, then utilize the dependence service message, to the creation waiting task When targeted current business message execute associated services processing, and delete the waiting task.
CN201510556778.5A 2015-09-02 2015-09-02 Service message processing method and device Active CN106487569B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510556778.5A CN106487569B (en) 2015-09-02 2015-09-02 Service message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510556778.5A CN106487569B (en) 2015-09-02 2015-09-02 Service message processing method and device

Publications (2)

Publication Number Publication Date
CN106487569A CN106487569A (en) 2017-03-08
CN106487569B true CN106487569B (en) 2019-10-22

Family

ID=58237933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510556778.5A Active CN106487569B (en) 2015-09-02 2015-09-02 Service message processing method and device

Country Status (1)

Country Link
CN (1) CN106487569B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446183B (en) * 2017-08-31 2022-04-26 北京京东尚科信息技术有限公司 Global anti-duplication method and device
CN108712501B (en) * 2018-05-28 2023-04-07 腾讯科技(北京)有限公司 Information sending method and device, computing equipment and storage medium
CN108985629B (en) * 2018-07-17 2022-04-08 创新先进技术有限公司 Method and device for executing service node in service chain and server
CN113076202A (en) * 2020-01-06 2021-07-06 北京沃东天骏信息技术有限公司 Message state determination method and device, computer readable medium and electronic equipment
CN111967855A (en) * 2020-08-27 2020-11-20 吉林亿联银行股份有限公司 Method, device and equipment for processing service data and computer readable storage medium
CN114374650B (en) * 2022-01-05 2024-02-13 北京理房通支付科技有限公司 Notification sending method based on routing middleware, storage medium and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100596050C (en) * 2006-03-27 2010-03-24 阿里巴巴集团控股有限公司 Message reliable informing method and system between systems
US8990332B2 (en) * 2009-12-21 2015-03-24 International Business Machines Corporation Performance optimization of a publish operation
CN102469033B (en) * 2010-11-01 2014-08-06 阿里巴巴集团控股有限公司 Message subscription system and message sending method
CN102761469B (en) * 2011-04-27 2015-05-27 阿里巴巴集团控股有限公司 Allocation method and device for resource pool
CN104579905B (en) * 2013-10-15 2018-11-06 阿里巴巴集团控股有限公司 Message delivery method and system and MOM servers, receiving terminal

Also Published As

Publication number Publication date
CN106487569A (en) 2017-03-08

Similar Documents

Publication Publication Date Title
CN106487569B (en) Service message processing method and device
CN108154322B (en) Inventory real-time management method and inventory system
US7475275B2 (en) Method for fault handling in a co-operative workflow environment
CN110070312A (en) Order processing method and apparatus
CN106844372B (en) Logistics information query method and device
JP2021519735A (en) Methods and equipment for transporting product shelves
CN106406826B (en) Joint debugging task creation method, system joint debugging method and device
CN105096122B (en) A kind of split blade type deals match method and apparatus
CN104008474A (en) Data processing method and system
CN110852659A (en) Logistics management method and device
CN108228363A (en) A kind of message method and device
CN112785215B (en) Method and device for generating picking path
CN109902975A (en) Dispatching method, system, device and computer readable storage medium
EP2913752A1 (en) Rule distribution server, as well as event processing system, method, and program
CN111260270A (en) Method and device for improving order processing efficiency of store
US20080103862A1 (en) Instant messaged forms based business process decision point facilitation
CN110473097A (en) Transaction monitoring method, terminal and computer readable storage medium
CN108242021A (en) A kind of processing system of accounting data, method and device
CN113888769B (en) Inspection method and device and electronic equipment
CN114841769A (en) Parcel information updating method and device
CN115525665A (en) Information processing method and device, electronic equipment and computer readable medium
CN108446361A (en) Processing method, server and the processing system of transaction data
US8495040B2 (en) Systems and methods for providing an automated validity check of transactional data postings
CN113780923A (en) Method and device for sending piece, electronic equipment and medium
CN111461430A (en) Method and device for generating route information

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20180328

Address after: Four story 847 mailbox of the capital mansion of Cayman Islands, Cayman Islands, Cayman

Applicant after: CAINIAO SMART LOGISTICS HOLDING Ltd.

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Applicant before: ALIBABA GROUP HOLDING Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant