Designing IBM WebSphere MQ applications

When you have decided how your applications can take advantage of the platforms and environments available to you, you need to decide how to use the features offered by WebSphere® MQ.

When designing an IBM® WebSphere MQ application consider the following questions and options:
Type of application
What is the purpose of your application? See the following links for information about that different types of application you can develop:
  • Server
  • Client
  • Publish/subscribe
  • Web services
  • User exits, API exits, and installable services

Additionally, you can also write your own applications to automate administration of IBM WebSphere MQ. For more information, see Introduction to the WebSphere MQ Administration Interface (MQAI) and Automating administration tasks .

Programming language
IBM WebSphere MQ supports a number of procedural and object-oriented programming languages for writing applications. For more information see, Deciding which programming language to use.
Applications for more than one platform

Will your application run on more than one platform? Do you have a strategy to move to a different platform from the one that you use today? If the answer to either of these questions is yes, ensure that you code your programs for platform independence.

If you are using C, code in ANSI standard C. Use a standard C library function rather than an equivalent platform-specific function even if the platform-specific function is faster or more efficient. The exception is when efficiency in the code is paramount, when you should code for both situations using #ifdef. For example:

#ifdef _AIX
     AIX specific code
#else
     generic code
#endif
Types of queues
Do you want to create a queue each time that you need one, or do you want to use queues that have already been set up? Do you want to delete a queue when you have finished using it, or is it going to be used again? Do you want to use alias queues for application independence? To see what types of queues are supported, refer to Queues .
Using queue manager clusters
You might want to take advantage of the simplified system administration, and increased availability, scalability, and workload balancing that are possible when you use clusters. See Queue manager clusters for more information.
Types of messages
You might want to use datagrams for simple messages, but request messages (for which you expect replies) for other situations. You might want to assign different priorities to some of your messages. For more information about designing messages, see Designing your messages.
Using publish/subscribe or point-to-point messaging
Using publish/subscribe messaging, a sending application sends the information that it wants to share in an IBM WebSphere MQ message to a standard destination managed by IBM WebSphere MQ publish?subscribe, and lets IBM WebSphere MQ handle the distribution of that information. The target application does not have to know anything about the source of the information it receives, it just registers an interest in one or more topics and receives that information when it is available. For more information about publish/subscribe messaging, see Introduction to IBM WebSphere MQ publish/subscribe messaging .

Using point-to-point messaging, a sending application sends a message to a specific queue, from where it knows a receiving application will retrieve it. A receiving application gets messages from a specific queue and acts on their contents. An application will often function both as a sender and a receiver, sending a query to another application and receiving a response.

Controlling your IBM WebSphere MQ programs
You might want to start some programs automatically or make programs wait until a particular message arrives on a queue (using the IBM WebSphere MQ triggering feature, see Starting IBM WebSphere MQ applications using triggers). Alternatively, you might want to start another instance of an application when the messages on a queue are not getting processed fast enough (using the IBM WebSphere MQ instrumentation events feature as described in Instrumentation events).
Running your application on an IBM WebSphere MQ client
The full MQI is supported in the client environment and this enables almost any IBM WebSphere MQ application to be relinked to run on an IBM WebSphere MQ MQI client. Link the application on the IBM WebSphere MQ MQI client to the MQIC library, rather than to the MQI library.
Note: An application running on an IBM WebSphere MQ client can connect to more than one queue manager concurrently, or use a queue manager name with an asterisk (*) on an MQCONN or MQCONNX call. Change the application if you want to link to the queue manager libraries instead of the client libraries, as this function will not be available.

See Running applications in the IBM WebSphere MQ MQI client environment for more information.

Application performance
Design decisions can impact your application performance, for suggestions for enhancing performance of IBM WebSphere MQ applications, see Application design and performance.
Advanced IBM WebSphere MQ techniques
For more advanced applications you might want to use some advanced IBM WebSphere MQ techniques such as correlating replies, and generating and sending IBM WebSphere MQ context information. For more information, see Advanced IBM WebSphere MQ techniques.
Securing your data and maintaining its integrity
You can use the context information that is passed with a message to test that the message has been sent from an acceptable source. You can use the syncpointing facilities provided by IBM WebSphere MQ or your operating system to ensure that your data remains consistent with other resources (see Committing and backing out units of work for further details). You can use the persistence feature of IBM WebSphere MQ messages to assure the delivery of important messages.
Testing IBM WebSphere MQ applications

The application development environment for IBM WebSphere MQ programs is no different from that for any other application, so you can use the same development tools as well as the IBM WebSphere MQ trace facilities.

Handling exceptions and errors
You need to consider how to process messages that cannot be delivered, and how to resolve error situations that are reported to you by the queue manager. For some reports, you must set report options on MQPUT.