-
2010-11-30
11/495,053
2006-07-28
US 7,844,759 B1
2010-11-30
-
-
Henry W Tsai | Titus Wong
2026-07-31
A method, system, and computer readable medium for processing a message queue comprises processing messages in the queue in a serial manner, suspending a message, when the processing is blocked for the message, processing a next message in the queue during the suspension, continuing the processing of the messages until the processing is unblocked, placing the message back in the queue, and processing the message.
Get notified when new applications in this technology area are published.
G06F3/00 IPC
Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
G06F9/44 IPC
Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs Arrangements for executing specific programs
The present invention is related to message processing, and, more specifically to processing a message queue utilizing a software or computer agent.
The term โagentโ describes a software abstraction, an idea, or a concept and provides a convenient and powerful way to describe a complex software entity that is capable of acting with a certain degree of autonomy in order to accomplish tasks on behalf of its user. But unlike objects, which are defined in terms of methods and attributes, an agent is defined in terms of its behavior. An autonomous software agent is a stand-alone computer program that performs tasks on behalf of a controlling entity, but without direct, continuous supervision. The autonomous agent may utilize network resources and services, but works relatively independently of other software agents that may be a part of a multi-agent system.
Since agents are well suited to include their required resources in their description, they can be designed to be very loosely coupled and it becomes easy to have them executed as independent threads and on distributed processors. Thus they become distributed agents and the considerations of distributed computing apply. Agent code is particularly easy to implement in a distributed fashion and scales well.
With distributed agent systems, it is desirable for an agent to process only one message at a time so that data integrity is maintained and race conditions are avoided. In such a situation, problems arise when, during the processing of a message, blocking occurs because of another message sent to another agent causing the agent to become unresponsive for some period of time. This period can sometimes be in the seconds or even minutes. Therefore, what is needed is a solution that overcomes these problems and limitations.
The present invention provides a system, method, and computer readable medium for processing messages in a message queue. A message is the basic unit of data sent from one software agent to another or from a sender to its recipients. The structure of the message is defined in service descriptions by a message description language. A message is defined as a construct that can include zero or more headers, an envelope, data within the envelope and data external to the envelope. The header part of a message can include information pertinent to extended services functionality, such as security, transaction context, orchestration information, message routing information, or management information. The data part of a message contains the message content or URIs to the actual data resource.
With the present invention, if an agent becomes unresponsive for some period of time because of a particular message, that message is suspended (for example, if processing is taking too long or if processing is blocked). When the message is unblocked the message is placed back onto the queue for later processing. Once the message is reached in the queue for processing, the processing is released from the point where it was suspended. With unblocking asynchronous processing for computer agents, agent systems become highly available, improving overall processing of messages and increasing overall performance and availability.
In one embodiment, a method for processing a message queue comprises processing messages in the queue in a serial manner, suspending a message, when the processing is blocked for the message, processing a next message in the queue during the suspension, continuing the processing of the messages until the processing is unblocked, placing the message back in the queue, and processing the message.
In another embodiment, a system comprises message queues and autonomous computer agents sending self-contained messages to each other from each of their respective message queues, wherein the messages are processed serially, wherein a message is suspended: when the processing is blocked for the message and until an inner send is completed.
In a further embodiment, a computer readable medium comprises instructions for: suspending a message in a queue, when processing is blocked for the message, processing a next message in the queue during the suspension, continuing the processing of the messages until the processing is unblocked, placing the message back in the queue, and when the message is reached in the queue, processing the message.
FIG. 1 depicts a multi-agent system consisting of autonomous computer agents sending self-contained messages to each other in accordance with a preferred embodiment of the present invention; and
FIG. 2 depicts a suspended processing of a current message in accordance with a preferred embodiment of the present invention.
FIG. 1 depicts an agent's message queue 10 in a multi-agent system consisting of autonomous computer agents sending self-contained messages to each other. The agent's queue 10 comprises messages 1 through N which are processed serially. In this case, a message is sent synchronously via the following signature: Reply send (aMessage), where aMessage is a self-contained message that can be sent outside the bounds of a process and Reply is the self-contained message with possible changes and results contained within it. Any asynchronous message can be made synchronous by waiting for a reply before allowing execution to continue. Therefore, the send method is blocked until the receiving agent reaches the message and the message is processed.
In order for the agent to properly process messages without deadlock or race conditions, only a single message is allowed to be processed from the queue 10 at a time. In this case, if the message calls another agent during the processing and therefore blocks, the agent is unable to process messages until a reply is received. If the message blocks for some longer period of time, the agent is unavailable to process other messages in the queue. Therefore, the computer agent becomes less available.
Referring now to FIG. 2, The present invention suspends processing of the current (blocked) message until the inner send( ) is completed. Once completed, the message is placed back onto the queue 10 for later processing. Once the message is reached, it is released( ) to continue processing. This novel method for processing queued messages allows for the autonomous computer agent to be more available and not blocked during its own calls to other agents while ensuring that only one message is processed at a time.
In one embodiment of the present invention, a method for processing a message queue comprises processing messages in the queue in a serial manner, suspending a message, when the processing is blocked for the message, processing a next message in the queue during the suspension, continuing the processing of the messages until the processing is unblocked, placing the message back in the queue, and processing the message.
In the method, a software agent is processing the messages, wherein the software agent may send another message to another software agent. The processing may be blocked based on at least one of: a non-reply to the processing of the messages, an input/output block (for example, a block while attempting to connect to a socket), and a time-out. The processing is unblocked based on receiving a reply from an intended destination, wherein the intended destination is at least one of: a software agent, and an input/output port.
The method further comprises wrapping the message in another message intended for special processing, when the processing is unblocked, wrapping the message in another message intended for special processing, when the message is placed in the queue, wherein the message intended for special processing releases a thread of execution of the message. The processing of the messages is continued in the queue in the serial manner after the processing of the message.
In another embodiment of the present invention, a system comprises message queues and autonomous computer agents sending self-contained messages to each other from each of their respective message queues, wherein the messages are processed serially, wherein a message is suspended: when the processing is blocked for the message and until an inner send is completed. Once the inner send is completed, the message is placed back onto the appropriate queue for later processing, wherein once the message is reached in the queue, it is released to continue processing, wherein an autonomous computer agent is not blocked during its own call to another agent while ensuring that only one message is processed at a time.
In a further embodiment of the present invention, a computer readable medium comprises instructions for: suspending a message in a queue, when processing is blocked for the message, processing a next message in the queue during the suspension, continuing the processing of the messages until the processing is unblocked, placing the message back in the queue, and when the message is reached in the queue, processing the message.
The computer readable medium also comprises continuing the processing of the messages in the queue in a serial manner after the processing of the message, wrapping the message in another message intended for special processing, when the processing is unblocked, wrapping the message in another message intended for special processing, when the message is placed in the queue, wherein the message is blocked if the message calls another agent during processing of the message, wherein an agent is unable to process messages until a reply is received.
Although an exemplary embodiment of the system, method, and computer readable medium of the present invention has been illustrated in the accompanied drawings and described in the foregoing detailed description, it will be understood that the invention is not limited to the embodiments disclosed, but is capable of numerous rearrangements, modifications, and substitutions without departing from the spirit of the invention as set forth and defined by the following claims.
1. A computer-implemented method for processing a message queue, comprising:
processing messages in the message queue in a serial manner, wherein a message structure is defined in service descriptions by a message description language and processing a message comprises processing the message structure;
suspending processing of at least a further message that is not in the message queue when the processing of the further message is blocked, the further message having a thread of execution, the further message having been previously removed from the message queue;
processing one or more next messages in the message queue during suspension of the further message;
responsive to the processing of the further message becoming unblocked, placing the further message back in the message queue; and
resuming processing of the further message.
2. The computer-implemented method of claim 1, wherein the method is performed by a software agent.
3. The computer-implemented method of claim 2, wherein the software agent is configured to optionally send a message to another software agent.
4. The computer-implemented method of claim 1, wherein the processing of the further message is blocked based on at least one of:
a non-reply to the processing of the further message;
an input/output block; or
a time-out.
5. The computer-implemented method of claim 1, wherein the processing of the further message unblocked based on receiving a reply from an intended destination.
6. The computer-implemented method of claim 5, wherein the intended destination is at least one of:
a software agent; or
an input/output port.
7. The computer-implemented method of claim 1 further comprising wrapping the further message in another message intended for special processing, when the processing of the further message is unblocked.
8. The computer-implemented method of claim 7, wherein said wrapping the further message occurs prior to placing the further message back in the message queue.
9. The computer-implemented method of claim 8, wherein the message intended for special processing releases the thread of execution of the further message.
10. The computer-implemented method of claim 1 further comprising continuing processing of messages in the message queue in a serial manner after processing the further message.
11. An article of manufacture including a non-transitory computer-readable medium having instructions stored thereon that, in response to execution by a computing device, cause the computing device to implement a system comprising:
a plurality of message queues;
a plurality of autonomous computer agents, wherein at least one of the autonomous computer agents contains one of the message queues, wherein the autonomous computer agents are configured to send self-contained messages to each other from their respective message queues;
wherein the autonomous computer agents are configured to process the self-contained messages serially, wherein a self-contained message structure is defined in service descriptions by a message description language and to process a self-contained message comprises processing the self-contained message structure;
wherein the autonomous computer agents are configured to suspend processing of at least one of the self-contained messages when processing of the at least one self-contained message is blocked and until an inner send is completed, the at least one self-contained message having a thread of execution, the inner send being a send of a message that originates from within the thread of execution; and
wherein at least one of the autonomous computer agents is configured to place, once the inner send is completed, the at least one self-contained message back on to one of the message queues for later processing, the self-contained message having been previously removed from the one of the message queues.
12. The article of manufacture of claim 11, wherein at least one of the autonomous computer agents is configured to release, once the self-contained message is reached in the queue, the at least one self-contained message to continue processing.
13. The article of manufacture of claim 12, wherein at least one of the autonomous computer agents is configured to not be blocked during the at least one autonomous computer agent's own call to another autonomous computer agent while ensuring that only one self-contained message is processed at a time.
14. A tangible non-transitory computer-readable medium having stored thereon, computer-executable instructions that, in response to execution by a computing device, cause the computing device to perform operations comprising:
suspending processing of at least one message when processing of the message is blocked, the message having a thread of execution, the message having been previously removed from a queue, wherein a message structure is defined in service descriptions by a message description language and processing a message comprises processing the message structure;
processing one or more next messages in the queue during suspension of the message;
placing the message that was blocked back in the queue when the processing of the message becomes unblocked; and
resuming processing of the message that was blocked when the message is reached in the queue.
15. The tangible non-transitory computer-readable medium of claim 14 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations further comprising processing messages in the queue in a serial manner after processing the message that was blocked.
16. The tangible non-transitory computer-readable medium of claim 14 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations further comprising wrapping the message in another message intended for special processing, when the processing of the message is unblocked.
17. The tangible non-transitory computer-readable medium of claim 16 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations further comprising wrapping the message prior to placing the message back in the queue.
18. The tangible non-transitory computer-readable medium of claim 14 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations further comprising blocking the message while the message calls an external agent during the processing of the message.
19. The tangible non-transitory computer-readable medium of claim 18 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations wherein an agent is unable to process the message until a reply is received.
20. A computer-implemented method for processing a message queue, comprising:
processing messages in the message queue, wherein a message structure is defined in service descriptions by a message description language and processing a message comprises processing the message structure;
suspending processing of at least a further message that is not in the message queue when the processing of the further message is blocked, the further message having a thread of execution, the further message having been previously removed from the message queue;
processing one or more next messages in the message queue during suspension of the further message;
responsive to the processing of the further message becoming unblocked, wrapping the further message in another message intended for special processing and placing the further message back in the message queue; and
resuming processing of the further message.
21. The computer-implemented method of claim 20, wherein the method is performed by a software agent.
22. The computer-implemented method of claim 21 wherein the software agent is configured to optionally send a message to another software agent.
23. The computer-implemented method of claim 20, wherein the processing of the further message is blocked based on at least one of:
a non-reply to the processing of the further message;
an input/output block; or
a time-out.
24. The computer-implemented method of claim 20, further comprising receiving a reply from an intended destination, wherein the processing of the further message is unblocked based on receiving the reply.
25. The computer-implemented method of claim 24, wherein the intended destination comprises at least one of:
a software agent; or
an input/output port.
26. The computer-implemented method of claim 20, further comprising processing the message intended for special processing which in turn releases the thread of execution of the further message wrapped within the message intended for special processing.
27. The computer-implemented method of claim 20 further comprising continuing processing of messages in the message queue after processing the further message.
28. An article of manufacture including a non-transitory computer-readable medium having instructions stored thereon that, in response to execution by a computing device, cause the computing device to implement a system comprising:
a plurality of message queues;
a plurality of autonomous computer agents, wherein at least one of the autonomous computer agents contains one of the message queues, wherein the autonomous computer agents are configured to:
send self-contained messages to each other from each of their respective message queues;
process the self-contained messages, wherein a self-contained message structure is defined in service descriptions by a message description language and to process a self-contained message comprises processing the self-contained message structure;
suspend processing of at least one of the self-contained messages when processing of the at least one self-contained message is blocked and until an inner send is completed, the at least one self-contained message having a thread of execution, the inner send being a send of a message that originates from within the thread of execution;
wrap the at least one self-contained message that was blocked in another message that is intended for special processing after the inner send is completed; and
place the at least one self-contained message back on to one of the message queues for later processing after wrapping the at least one self-contained message, the at least one self-contained message having been previously removed from the one of the message queues.
29. The article of manufacture of claim 28, wherein at least one of the autonomous computer agents are configured to release, once the at least one self-contained message is reached in the one of the message queues, the at least one self-contained message to continue processing.
30. The article of manufacture of claim 29, wherein at least one of the autonomous computer agents is configured to not be blocked during the at least one autonomous computer agent's own call to another autonomous computer agent while ensuring that only one self-contained message is processed at a time.
31. A tangible non-transitory computer-readable medium having stored thereon, computer-executable instructions that, in response to execution by a computing device, cause the computing device to perform operations comprising:
suspending processing of at least one message when processing of the message is blocked, the message having a thread of execution, the message having been previously removed from the queue, wherein a message structure is defined in service descriptions by a message description language and processing a message comprises processing the message structure;
processing one or more next messages in the queue during suspension of the message;
wrapping the message that was blocked in another message intended for special processing when the processing of the message becomes unblocked, wherein the message intended for special processing releases the thread of execution of the message;
placing the message that was blocked back in the queue after the message is wrapped; and
processing the message that was blocked when the message is reached in the queue.
32. The tangible non-transitory computer-readable medium of claim 31 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations further comprising processing messages in the queue in a serial manner after processing the message that was blocked.
33. The tangible non-transitory computer-readable medium of claim 31 having stored thereon, computer-executable instructions that, in response responsive to execution by the computing device, cause the computing device to perform operations further comprising calling an external agent during the processing of the message, wherein the message is blocked during the call to the external agent.
34. The tangible non-transitory computer-readable medium of claim 33 having stored thereon, computer-executable instructions that, in response to execution by the computing device, cause the computing device to perform operations wherein an agent is unable to process the message until a reply is received.