Magento 2 Integration

Integrating Magento 2 with IBM Sterling Order Management System

Rahul Anand

Rahul Anand

Sr. Technical Lead

Published Oct 17 2019

As an e-commerce platform, Magento offers a flexible shopping cart system with adequate control over the design, content, and functionality for an online store, which makes it a preferred choice of many businesses. The online order fulfillment process is getting complicatedly with each passing day due to the rapidly changing market demands. Despite all these capabilities, there is a need for additional support to offer a seamless shopping experience to the customers.

Order management requires a multi-dimensional system that touches nearly every facet of how your business operates. Such as:

  • Customers
  • Sale channels
  • Product information
  • Inventory levels and location
  • Suppliers for purchasing and receiving
  • Customer service; namely, returns and refunds
  • Order printing, picking, packing, processing, and shipping

Hence, there is a necessity to augment the capabilities of Magento with an efficient Order Management System (OMS).

Also known as Distributed Order Management (DOM), an order management system is any tool or platform that tracks your business sales, orders, and inventory. It enables a system to keep an eye on the fulfillment process to locate the order and determine the inventory stock. Additionally, it allows e-commerce businesses to track the broken and returned items.

Why Integrate Magento 2 with an Order Management System?

Integrating a good OMS plays a vital role in the Magento delivery system. It improves Magento’s order tracking and inventory capabilities. Today, most large organizations have IT systems from various vendors that make it challenging to communicate and share data across systems and with the suppliers who may have disparate systems.

An OMS can act as a central hub that connects all other IT systems and serve information to other channels, keeping all the connections in sync. As a result, it allows you to develop a seamless multi-channel experience for your customers.

As per industry standards, if you’re processing more than ten orders a day, you should be using an order management system. Some of the popular OMS systems are IBM Sterling OMS, Magento OMS, and SAP Hybris. To choose the one that fits your requirement, you must consider the factors like price, order amount for a month, number of users permissible, support plan, and integrated shipping & inventory management.

IBM Sterling OMS: A Comprehensive Order Management System

IBM Sterling OMS orchestrates orders with a global view of inventory and provides a digital way to manage the order life cycle. It combines multichannel order aggregation, inventory and delivery visibility, and service availability within a single platform for omnichannel order fulfillment.

For organizations using IBM Sterling OMS as an order management tool and Magento 2 as an e-commerce channel, the integration between Magento 2 and IBM Sterling OMS is a key to manage end-to-end omnichannel e-commerce operations.

For an external e-commerce system like Magento 2, Websphere MQ is a recommended channel by IBM to connect to the IBM Sterling OMS. It is a midway communicator that helps external e-commerce channels to connect to the IBM Sterling OMS for a two-way information flow of all the order and inventory fulfillment. IBM Team has written service contracts and adapters in the IBM Sterling framework for integrating the Websphere MQ with IBM Sterling OMS to process the sales operations.

Steps to Integrate Magento 2 with IBM Sterling OMS

We can integrate IBM Sterling OMS by installing the MQ Series library in PHP. The MQ Series extension provides an interface for communicating with IBM WebSphere MQ Series queue managers. Written in C-API, this interface can interact with WebSphere MQ.

WebSphere MQ facilitates application integration by passing messages between applications and web services. In ‘Messaging,’ the programs communicate by sending each other messages (data) rather than calling.

Step 1: Install MQ Series library

The user must install the MQ Series separately. It does not come bundled with default PHP libraries.

Step 2: Connect to a queue manager

Depending on the compilation of the extension, a user can connect to a queue manager in two ways:

  1. By compiling and linking the extension with MQIC libraries. It allows the extension to connect to the queue manager using the client interface. Remote connections are possible with this approach.
  2. By compiling and linking with MQM libraries. In this approach, it is possible to make use of the transaction management of a queue manager.

Connecting MQ Series to a Queue manager

Step 3: Confirm Connectivity

After installing the library, the following code should be executed with the MQM configuration to confirm connectivity.


if (!extension_loaded('mqseries')) {
            if (preg_match('/windows/i', getenv('OS'))) {
                dl('php_mqseries.dll');
            } else {
                if (!dl('mqseries.so')) {
                    exit;
                }

            }
        }
        $mqcno = array(
            'Version' => 4, //MQCNO_VERSION_4
            'Options' => MQSERIES_MQCNO_STANDARD_BINDING,
            'MQCD'    => array(
                'Version'        => 7, //MQCD_VERSION_7
                'ConnectionName' => $this->_certUrl,
                'TransportType'  => MQSERIES_MQXPT_TCP,
                'ChannelName'    => 'SYSTEM.SSL.SVRCONN',
                'SSLCipherSpec'  => 'TLS_RSA_WITH_AES_128_CBC_SHA256',
            ),
            'MQSCO'   => array(
                'KeyRepository' => '/opt/mqm/java/jre64/jre/bin/key', //Local path where the SSL key repository can be found
            ),
        );
        mqseries_connx('MQUEUE_MANAGER', $mqcno, $conn, $comp_code, $reason);
        if ($comp_code !== MQSERIES_MQCC_OK) {

            $this->logger->info("Error ! CONNX CompCode:" . $comp_code . " Reason:" . $reason . " Text:" . mqseries_strerror($reason));
            exit;
            return null;
        } else {
            $this->logger->info(" MQUEUE_MANAGER - MQ Queue connected. Ready for publishing messages to MQ.");
        }

You can also read about how we delivered omnichannel using Magento 2 and IBM Sterling order management.

A Word of Caution

In the above integration process, issues can occur when the foundation jars from the Websphere Commerce server are not installed correctly on the Magento server or queues are not configured correctly. To avoid this error, ensure to copy all foundation core and server jars to the Magento server. You can also check whether the queues are configured and well tested.

Make sure to use the right queue name when sending/receiving the data. Using wrong queues may either result in data loss, or the data may not be able to update correctly on one of the servers. Moreover, you may miss a message if the data is not handled properly, which may create inconsistent data between the systems.

Once MQM is connected, Magento 2 module can communicate with the WebSphere MQ to send and receive messages. It enables a real-time asynchronous messaging system and provides the ability to handle large volumes of back-and-forth communication. As a result, an e-commerce business can have an efficient mechanism to manage complex order management life cycle.