Background technology
In distributed integrated management application development platform (iMAP-MDP), message based distributed platform (MDP) is responsible for the message transmission of whole system.Other all application processes and platform connects in the system, carries out information interaction by the message transmission.Under this structure, directly do not connect between other application processes in the General System.In the iMAP-MDP platform, often a kind of client-server structure that adopts is, client (or claiming the foreground) and server end (or claiming the backstage) are all as an application program in the iMAP-MDP comprehensive platform.Consult shown in Figure 1.
The Message Processing of client generally has two kinds: synchronization message and asynchronous message.When client is connected to MDP, be actually set up two with being connected of MDP.Synchronization message is handled the synchronization request that client sends, and asynchronous message is then handled the asynchronous request that client sends and received notice reporting message from MDP.Asynchronous message does not block other threads of client.
Under the situation of synchronization request, client sends a request message to MDP, MDP handles to the specific task in backstage this forwards, in processing procedure, client is in the waiting process of an obstruction, up to receiving the response message that the backstage is returned, client just continues to carry out.
Under the situation of asynchronous request, client sends a request message to MDP, continues other processing then.After client asynchronous message processing module received message from MDP, if judge it is request message, the particular module that then sends to client was handled.If judge it is not request message, then traversal has been subscribed to the module of this message, and each module is carried out the processing of reporting message according to message content.
Characteristic according to above-mentioned MDP, client is if the progress on reflection backstage, then client must receive the implementation status on backstage, if and the message of this implementation status is handled by synchronization message, then the task of server end needs constantly to send response message to client in the process of implementation, the response of mid portion needs special processing, and the message of Fa Songing is only the result that client really needs at last.This mode can be called the mode of response stage by stage.Adopt this mode that following shortcoming is arranged:
(1) because each supports the server end of response stage by stage all to need the support of interface, therefore needs to revise existing interface;
(2) client can only be known and finished several steps, but under the initial situation, does not know total progress, thereby can not really reflect the progress of server end.
Summary of the invention
The object of the present invention is to provide a kind of method of client reflection Task Progress of message based distributed platform, exist client can not really reflect the problem of server end progress to solve in the prior art.
For addressing the above problem, the invention provides following technical scheme:
A kind of method of client reflection Task Progress of message based distributed platform, described distributed platform utilizes synchronization message interface and asynchronous message interface pass-along message between the client and server end; The method comprising the steps of:
But the wait window of a progress displaying of client terminal start-up, and send a request message by the synchronization message interface;
Carry out respective handling according to the message initiated server end of described request, and in processing procedure, send the notice reporting message that comprises the progress indication;
Described client receives described notice reporting message by the asynchronous message interface, analyzes wherein progress indication and progress displaying.
Wherein:
By determining that between the client and server end a specific message number reflects the message of server end progress, client is subscribed to this specific message number when starting the wait window, and goes to subscribe to this specific message number when waiting for close.
When the progress Indication message of a plurality of client query different server ends, server end is specified the recipient in notice reporting message, give this recipient by described message desk with this notice reporting forwards, only send to specific client to guarantee a progress indication.
The unique identification that also comprises the user ID or the client of current login in the progress indication that server end reports, client unique identification according to user ID or client when receiving the notice reporting message that comprises the progress indication judges whether should be the notice reporting message that this client receives, if then handle, otherwise abandon.
Server end is every carries out a progress point to notice reporting message that comprises the progress indication of client transmission, and wherein the progress indication can be and takes a step forward or multistep.
The present invention constantly indicates by notice reporting message transmission progress in the server-side processes process, client is by indication of asynchronous message interface reception progress and demonstration, therefore the present invention can accurately reflect the task executions situation on user interface, thereby improves availability.
Embodiment
Consult shown in Figure 1, in this architecture, directly do not connect between client (or title " foreground ") and the server end (or title " backstage "), but the function that provides by MDP (subscribe to, go to subscribe to, request, response) realizes the transmission of message, and the foreground can be by synchronization request and two kinds of communication interfaces of asynchronous request and MDP communication.If the foreground sends a synchronization request, the message processing module on foreground is in the state of wait-for-response always, carries out the processing of corresponding task by the task of a server end, and up to disposing and returning response message, work is just proceeded on the foreground.Therefore, in the prior art, the operation progress of server end can't be known in the foreground, thereby can't offer the implementation status of user task.
After the foreground sends synchronization message,, promptly in task processes, send notice reporting message and response message because the message that server end returns has two kinds.To cause the foreground to obtain request results and end inquiry if send response message, the notice reporting message that sends then sends to the foreground by the asynchronous message interface on foreground, and therefore, the present invention utilizes this characteristic to realize the reflection of progress.
The present invention mainly be by server end in processing procedure, constantly send the notice reporting message comprise the progress indication, the foreground utilizes the progress bar on the interface to be prompted to the user by the indication of asynchronous message interface reception progress then.
Consult shown in Figure 2ly, client display server end progress implementation procedure is as follows:
Step 10: but the wait window of a progress displaying of client terminal start-up, and pass through the request message that the synchronization message interface sends executable operations.
In suc scheme, require the foreground before carrying out a long operation, window is waited in one of general startup earlier, this window is just having a mould dialog box in executable operations for expression that can progress displaying, send a request message then, request message is in the obstruction thread, waits for that window then is in the another one thread, can carry out and refresh and other operations.
When starting the wait window, subscribe to a specific message, the progress on this message sink backstage when user's termination by the time or synchronous query finish, goes to subscribe to this message.In order to realize this mode, to determine the special message of a specific message number (as 999888) between the AM/BAM as the reflection progress.When waiting for that dialog box starts, subscribe message numbers 999888 is gone subscribe message numbers 999888 when waiting for that dialog box is closed.
Step 20:MDP gives server end with the described request forwards.
Step 30: server end carries out corresponding task according to request message to be handled, and sends the notice reporting message that comprises the progress indication in processing procedure.
If the task of this server process can reflect progress, then handling the beginning of this task, at first send a notice reporting message with total length indication to client, server end is in follow-up processing procedure, whenever, carry out a progress point, then send a notice reporting message to the foreground.
Step 40:MDP transmits described notice reporting message.
MDP is a kind of broadcast mode to the forwarding of notice reporting message, will send to the application program that all have subscribed to this message.
Step 50: client receives this notice reporting message by the asynchronous message interface, analyzes wherein progress indication and progress displaying.
When client receives progress message, if progress indication greater than 0, progress displaying bar then, and total length is set.If the progress indication equals 0, show no progress bar; If the progress indication is less than 0, then progress bar takes a step forward, if control flexibly can be represented to take a step forward with-1 ,-2 expressions were advanced for two steps, and the like.
To 50, can show the progress of service end Processing tasks by step 10 in client, its display effect is consulted shown in Figure 3.
Inquiring about simultaneously for a plurality of clients, then a plurality of wait windows receive progress simultaneously, because MDP transmits the notice reporting message that comprises the progress indication with broadcast mode, may cause the confusion of the progress of different application like this, therefore also need MDP to support a kind of processing of message in addition.
The basic function that MDP provides is request, response, notice reporting.The request response modes is that return messages are directly returned to caller, and notice reporting then is a kind of broadcast mode, and message is sent to the application program that all have subscribed to this message.Therefore need MDP that a kind of function is provided, promptly be a kind of notice reporting mode, and the recipient of appointment is arranged.Under this demand, at first need to revise the API (API) of MDP, increase a method, the permission application program directly is provided with the recipient in the message, send at the service end Processing tasks like this and give the correct time on the such notification, can specify the recipient, the information when the obtaining of recipient can utilize security module to obtain the client login.Certainly also need MDP itself is done some modifications, MDP reads thread and one by one to write thread and constitute, and the thread process flow process of reading of the prior art is consulted shown in Fig. 4 A:
When reading a message,, then subscribe to or go to subscribe to and handle, return then and read message if be judged as subscribe message or go subscribe message; If be judged as response message, search request person then if the requestor is arranged then transmit this message to the recipient, returns then and reads message, if do not have the requestor then directly return and read message; If be notice reporting message, then search the subscribe message storehouse, if this message does not have the subscriber, then return, if the subscriber is arranged then transmit this message to all subscribers.
The reason of revising the recipient allows this flow process enter in the processing of " do not have the requestor, but the recipient is arranged " exactly, and being about to specify has recipient's notice reporting message to handle as special response message.Consult Fig. 4 B, the thread process flow process difference of reading of the present invention is:
If be judged as response message, search request person then, if can not find the recipient, then search the subscribe message storehouse according to the recipient, if have subscription and subscriber consistent, then transmit this message, if do not find suitable subscriber to this subscriber with the recipient, then abandon this message, return then and read message.
Like this, can guarantee that a progress indication only sends to specific client, can not cause the unusual of a plurality of client progress indications, this also is a kind of solution more completely.This method also can further expand in the asynchronous request.Certainly if asynchronous request then owing to can operate simultaneously on the interface, may have a plurality of progress bars and show that simultaneously this just needs some expansions, as in the progress indication except the reflection progress, information such as user that can also additional request or module.
In addition, if only allow user's login in the system once, then can utilize this characteristic to realize client reflection back server end Task Progress, this mode does not need MDP is made an amendment fairly simplely.This method is:
If only allow user's login in the system once, then a dialog box is ejected in the foreground when sending synchronization request message, subscribes to specific message; And the transmission progress that server end does not stop in the process of Processing tasks indication, the progress indication that reports comprises: user name of current login (the perhaps unique identification on a foreground) and progress (comprise user name and progress in the particular content of message, as for embodying with what form, be numeral or character string etc., arrange to get final product) by the AM/BAM of concrete system.After client receives notice reporting message, judge whether the login username or the unique identification that return be consistent with active client, if consistent, then if progress displaying inconsistent, is not then handled.
The shortcoming of this mode is if a plurality of client is being carried out solicit operation simultaneously, then may receive the message of other client progresses of reflection, and this part message need be abandoned.Because client all will compare processing to each notice reporting message, if client is very many, can take a large amount of resource of client.Therefore, for the few application of client, can adopt this mode.
By said method, under the structure of existing iMAP-MDP, can provide progress bar accurately, the implementation progress of reflection background task, thereby the availability of raising system on the foreground of system.