1. Field of the Invention
The present invention generally relates to computer systems, and more specifically to a method and system of dynamic priority retrieval from a queue.
2. Description of Related Art
Message queuing provides reliable transfer of information between computer applications, regardless of the type of computer or network. Some commercial queuing packages, such as IBM's MQSeries, offer a high-level application program interface (API) which shields programs from the complexities of different operating systems and underlying networks.
A message is mainly a string of bits and bytes (data representing items such as account numbers, account balances, booking requests, names and addresses, images of documents, etc.) that one program wants to send to another. This type of data is often called application data. Of course, a message needs to include other information, such as its destination and possibly a return address. This type of data is called the message descriptor. A program sending a message defines the application data and supplies it. Such data can include character strings, bit strings, binary integers, packed-decimal integers, floating-point numbers, etc.
A message queue is an area of storage set aside (by a “queue manager”) to hold messages on their way from one program to another. In the prior art approach to message queuing, the sending queue and receiving queue are typically implemented as First-In, First-Out (FIFO) queues. With a FIFO implementation, messages are queued for transmission (and subsequently transmitted) in the order in which they are sent to the queuing system by the sending application. On the receiving side, the messages are stored in the queuing system in the order in which they are received from the network. When messages of varying priorities are sent and received, separate FIFO queues may be used for each different priority, with messages waiting in higher-priority queues being serviced before those in lower-priority queues. Or, a single queue may be used which mixes messages of different priority together, where a technique such as using separate head-of-queue pointers and linked lists for each priority enables finding higher-priority messages first—with the result that the queue is not processed in a strictly FIFO manner.
Thus, by default, a message queue works like a physical queue: first in is first out (FIFO). When using a queuing package, however, it is sometimes desirable to pull items out of the queue in priority. Unfortunately, most message queuing packages only allow the priority of a message to be set at the moment a message is placed on a queue. It is then impossible to change the priority of a message, and thus the order the messages will be retrieved. No techniques are known to the inventors which enable dynamically changing the priority of a message once it has been queued for transmission, and/or once message transmission has begun.
Some queuing packages allow the setting of a “key” in a message. A receiving process (program) specifies a particular key on its call to get a message from a queue, and only messages with that same key will be returned. This approach may incidentally allow prioritization of messages, but only if the receiving process assigns a high priority to a particular key. If there are no messages with that key, it then looks for its second most important key, etc. However, most queuing software requires that the key in the message and the key in the get call match exactly. This approach eliminates being able to search for categories of keys. Also, the number of keys that a single message can have is very limited, usually only one or two, restricting the manner in which properties of a message can be stored in the keys of a message. It would, therefore, be desirable to devise a method of pulling messages out of a queue with dynamic priority, and the queuing system return those messages in that priority.