Tuesday, August 21, 2012

Working with Message Queues in a Magic xpa Application

When most of us think of MQ or Message Queue, we think of a particular proprietary Message Queung product such as IBM WebSphere MQ, Microsoft Message Queue (MSMQ), or Java Message Service (JMS).
Message queuing technology has been available in data processing systems for many years. Email relies on queing, for example. Without queuing, sending an electronic message over the Internet would require that the sender and receiver were online simultaneously.  In a queuing system, messages are stored in intermediate nodes or servers until the system is ready to forward them. At their final destination they are stored in an email inbox until the recipient reads them.
Even so, many complex business transactions such as Web Services are processed today without queuing. In a large network, the system might be maintaining many thousands of connections in a ready-to-use state. If one part of the system suffers a problem, many parts of the system become unusable.
You can think of message queuing as being email for system to system messages. In an MQ environment, each application is designed to send and/or receive messages as part of an overall business process spanning several applications. A predefined queue will typically be used between two programs. The receiving program retrieves the message from the queue, and processes the requests and information contained in the message. So message queuing is a style of program-to-program communication.

Queuing, therefore, is a mechanism by which messages are held until an application processes them. Queuing allows you to communicate between heterogeneous programs without having to write the communication code that handles the transport of messages. You will be able to select the order in which a program processes messages. An MQ also allows you to maintain well-balanced loads on a system by arranging for more than one program to service a queue when the number of messages exceeds a threshold. Backup and failover can also be achieved by increasing the availability of your applications by arranging for an alternative system to service the queues if your primary system is unavailable.

One of the primary benefits of message queuing is that it ensures guaranteed delivery.
Message queuing lets applications send messages without waiting for a reply and to continue with other processes. Other applications can receive the messages at their leisure and continue processing according to the data received.

Message queuing is a method by which program instances can exchange data using an interface to a system-managed message queue, which is managed by the operating system. Application programs create message queues, and send and receive messages using an application program interface (API).

There are typically two main ways to send messages: Send and Receive or Publish and Subscribe. Send / Receive is used when there are one or more senders who want to send messages to one receiver. Each message is addressed to a specific queue, and the receiver extracts the message from the queue. Publish / Subscribe is used when there are multiple senders (publishers) and many receivers (subscribers). The publisher sends messages to a central location, the topic, which sends the messages to anyone who has subscribed to this specific topic. Both of these methods provide the user with guaranteed message delivery. Every access to the message queue is done using a set of programs, such as open, close, and send.

The Magic xpa Application Platform provides a message queuing component with interfaces to the three standard messaging queue systems we mentioned MSMQ (Microsoft), JMS, and  WebSphere MQ (IBM).

In each of the supported message queuing systems, Magic xpa provides four basic programs: Open Queue, Send Message, Read Message and Close Queue.
A very basic “read message” program may be comprised of the following program calls: Open Queue, Read Message, Close Queue.
In addition, the Magic xpa MQ component provides a Quick Send program, which opens a queue, sends a message, and closes the queue.
Each Open Queue program returns a queue handle, a numeric value, which is a number that identifies the connection to that open queue. Every interaction with that Open Queue is now performed using this handle.
Apart from the basic programs, the component provides additional programs, which differ according to the message queue system.
For an enterprise development team that needs a straightforward way to create and deploy business applications that use a popular MQ, the Magic xpa application platform provides excellent scalability and enterprise grade reliability for business applications. If you are already a Magic xpa developer, utilize MQ when the other applications in your environment are already expecting to send and receive such messages. It may be the clearest path to interoperability. If you are interested in creating MQ applications, and need a good tool for creating such applications, then the Magic xpa Application Platform should be considered for its ability to develop and deploy apps quickly and its support for native apps across mobile platforms (iOS, Android, BlackBerry, Windows) and server platforms (Windows, Linux, IBM i, Unix).

No comments:

Post a Comment