Messages and queues
Overview
Messages and queues are the basic components of a message queuing system.
A message is a string of bytes that is meaningful to the applications that use it. Messages are used to transfer information from one application program to another (or between different parts of the same application). The applications can be running on the same platform, or on different platforms.
WebSphere MQ messages have two parts:
- The application data.
The content and structure of the application data is defined by the application programs that use it.
- A message descriptor.
Identifies the message and contains additional control information, such as the type of message and the priority assigned to the message by the sending application.
Message lengths
The default maximum message length is 4 MB, although you can increase this to a maximum length of 100 MB. In practice, the message length might be limited by:
- The max message length defined for the receiving queue
- The max message length defined for the queue manager
- The max message length defined by the queue
- The max message length defined by either the sending or receiving application
- The amount of storage available for the message
It might take several messages to send all the information that an application requires.
How do applications send and receive messages?
Application programs send and receive messages using MQI calls.
For example, to put a message onto a queue, an application:
- Opens the required queue by issuing an MQI MQOPEN call
- Issues an MQI MQPUT call to put the message onto the queue
Another application can retrieve the message from the same queue by issuing an MQI MQGET call
What is a queue?
A queue is a data structure used to store messages.
Each queue is owned by a queue manager. The queue manager is responsible for maintaining the queues it owns, and for storing all the messages it receives onto the appropriate queues. The messages might be put on the queue by application programs, or by a queue manager as part of its normal operation.
WebSphere MQ V5.3 supports queues over 2 GB in size. See Enabling large queues for more information.
Predefined queues and dynamic queues
Queues can be characterized by the way they are created:
- Predefined queues are created by an administrator using the appropriate MQSC or PCF commands. Predefined queues are permanent; they exist independently of the applications that use them and survive WebSphere MQ restarts.
- Dynamic queues are created when an application issues an MQOPEN request specifying the name of a model queue. The queue created is based on a template queue definition, which is called a model queue. You can create a model queue using the MQSC command DEFINE QMODEL. The attributes of a model queue (for example, the maximum number of messages that can be stored on it) are inherited by any dynamic queue that is created from it.
Model queues have an attribute that specifies whether the dynamic queue is to be permanent or temporary. Permanent queues survive application and queue manager restarts; temporary queues are lost on restart.
Retrieving messages from queues
Suitably authorized applications can retrieve messages from a queue according to the following retrieval algorithms:
- First-in-first-out (FIFO).
- Message priority, as defined in the message descriptor. Messages that have the same priority are retrieved on a FIFO basis.
- A program request for a specific message.
The MQGET request from the application determines the method used.
Back | Next | Home
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.