D3 MQSeries Server Interface Overview

What is IBM MQSeries?

MQSeries, by IBM, is a messaging system that allows heterogeneous computer systems and software to exchange data. The information is exchanged through messaging queues managed by the Queue Manager responsible for receiving messages and making them available on the network for other systems to use. MQSeries also comprises a library of functions for developers to use in their own applications. This library is a common programming interface known as the Message Queue Interface (MQI).

With over 35 supported platforms, MQSeries is the ultimate solution for computer system and information integration.

For more information on MQSeries and how it works, see this link:

http://www-3.ibm.com/software/ts/mqseries/library/whitepapers/mqover/ 

What is D3 MQSeries Server Interface for MQSeries?

D3 MQSeries Server Interface is the implementation of the MQI library (Message Queue Interface) in FlashBASIC and C. The D3 MQSeries Server Interface library allows D3 developers to send and receive MQSeries messages directly from BASIC programs. The D3 MQSeries Server Interface library also includes subroutines to manage the MQSeries Queue Manager.

How Does it Work?

The diagram below illustrates the architecture of a typical MQSeries installation and a D3 Server equipped with the D3 MQSeries Server Interface. The D3 MQSeries Server Interface is a combination of FlashBASIC programs and C functions that directly interface with the MQSeries MQI library. The MQI library is linked to the D3 engine making it part of D3. The FlashBASIC subroutines are used to interface with the MQI function calls. This makes it totally transparent to the BASIC developer.

 

 

 

The BASIC program examples below show how to use D3 MQSeries Server Interface and FlashBASIC API calls to interface with a Queue Manager.

To read a message from the Queue:

Call MQConn();

Opens a connection to the Queue Manager.

Call MQOpen();

Opens the Message Queue to get the message from.

Call MQGet();

Gets the message from the open queue.

Call MQClose();

Closes the Message Queue previously opened.

Call MQDisc();

Closes the connection from the Queue Manager.

 

To send a message to the Queue:

Call MQConn();

Opens a connection to the Queue Manager.

Call MQOpen();

Opens the Message Queue to put the message to.

Call MQPut();

Writes/Puts the message to the open queue.

Call MQClose();

Closes the Message Queue previously opened.

Call MQDisc();

Closes the connection from the Queue Manager.

 

As shown in the examples above, reading from and writing to a queue is a simple process. Because the MQSeries Queue Manager handles everything, the BASIC developer does not need to know or worry about network protocols or how to communicate with remote systems. The BASIC programs that use the D3 MQSeries Server Interface are capable of exchanging information with any MQSeries supported platforms and applications.

Other MQI calls are available in order to manage a Queue Manager. These include:

MQBegin

Begin a unit of work.

MQBack

Back out of an uncommitted unit of work.

MQCMIT

Commit to a unit of work.

MQPut1

Open a queue, place a message in the queue, and then close the queue.

MQInq

Inquire about a queue’s attribute.

MQSet

Set queue attributes.

 

For more information on these MQI calls, see the MQSeries User’s Guide.

Why Use D3 MQSeries Server Interface?

The D3 MQSeries Server Interface allows BASIC programs to interface and exchange information with any MQSeries supported platforms and applications. The scenario below is an example of why and how MQSeries can solve a business problem.

Scenario

Company X manufactures goods that are sold to the public through specialized stores across the country. Each store maintains its own product inventory and receives daily supply of goods from the main manufacturing plant. The quantity of goods delivered is based on the stores performance and size. Each store runs its own computer system to keep track of stock quantity and invoices and it’s local customer base. At closing of each day, an automatic process is run to calculate the stocks requirement for each product. An order form is then created and faxed to the manufacturing plant for product order and delivery.

The manufacturing plant is the head office of the company. Its computer system manages all aspects of product manufacturing, the overall stock quantity for each product and the store orders. Every night, it receives faxes from all the stores from all over the country.

NOTE—

Fax machines are not always reliable (that is, they jam,  run out of paper or ink, and so on) and therefore not all faxes are received.

 

The next day, the faxed store orders are manually entered in the system to generate the delivery order for each store.

Since the orders are entered in manually into the system, the orders received that day are processed the following day, and delivery of goods are processed two days after the order was received. This manual process can generate numerous errors and can cause further delays in the delivery of goods. At best, each store operates with a minimum of a two-day delay.

All the stores are equipped with D3 NT and running a custom built application in BASIC. The manufacturing plant runs a large AS400 system and a custom designed application.

Objective

The objective is to remove the manual (hand typed) and mechanical (fax machine) errors as much as possible and ship the products to the stores no later than the next day.

Requirements

Provide a way for the stores to send their orders directly to the main system eliminating the manual process, which eliminates any possible typing errors. The store orders are sent electronically to the main system. The main system automatically processes the orders through a programmed procedure and generates the shipping orders the same day.

The Problem

Because the process needs to be automated and unattended, when the orders are sent from the stores to the manufacturing plant, the stores’ computer systems need to make sure that the information is sent properly, and the manufacturing’s computer system needs to make sure that the order received is correct.

The stores’ and the manufacturing’s computer systems need to communicate through a common middleware. The use of different communication tools can generate errors due to the translation.

The stores’ orders need to be processed on a real-time basis; as soon as they are received by the main system.

The Solution

MQSeries provides a nice solution to the problem. By implementing MQSeries in the stores’ network, it becomes possible for all the stores to communicate with the main system on a real-time basis. The stores send their orders to the MQSeries Server as messages, and the main system retrieves the messages through the same MQSeries Server. Because MQSeries is capable of two-way communication, the main system can send a message back to the stores to inform them of their order statuses. The diagram below shows an overall synoptic of how such a solution would be implemented.

 

 

 

 

This solution requires that the existing application running on AS400 and the application running on D3 NT be modified to support the MQI library. As described in a previous section, the implementation of the D3 MQSeries Server Interface is simple and requires very little knowledge of IBM’s MQSeries. The implementation of the MQI library on AS400 is beyond the scope of this document.

Conclusion

MQSeries is a messaging system middleware that connects heterogeneous systems and applications through a common mechanism. The Application Programming Interface, MQI, provided with MQSeries is cross-platform and implemented in many programming languages. The D3 MQSeries Server Interface is Raining Data’s implementation of the MQSeries API in FlashBASIC. This allows BASIC programmers to interface their D3 applications with any platforms and applications that support MQSeries. MQSeries is the industry standard for messaging systems. The ability for D3 to use the MQSeries MQI library is critical to many business applications and provides solutions that would no be possible otherwise.