Open Source on IBM i

Even more Integration Possibilities

IBM i stands for integration. But it is most of the time very troublesome to connect to and integrate anything outside the IBM family. In the open world (outside the IBM i box) there are numerous ways to integrate and communicate between systems and applications.One way to do it is to use a messaging system. There are numerous messaging systems out there (like ActiveMQ, Artemis, Apollo from Apache or RabbitMQ to name only a few). Even IBM has such a system by the name of IBM MQ (short names must be the way-to-go at the moment as it was formerly named IBM Websphere MQ and MQSeries before that. IBM has a long track record of renaming things and we all know , don't we?! ;-) ).

But for RPG developers there was no easy way to communicate with these systems. Most programming language have some libraries which can be used to communicate with these systems in an easy way. RPG as so often doesn't have one.

Most of these messaging systems support the STOMP protocol. That is a simple text protocol which can be used to talk to these systems.

From the former STOMP web site (at

The STOMP project is the Streaming Text Orientated Messaging Protocol site (or the Protocol Briefly Known as TTMP and Represented by the symbol :ttmp). STOMP provides an interoperable wire format so that any of the available Stomp Clients can communicate with any STOMP Message Broker to provide easy and widespread messaging interop among languages, platforms and brokers.

So putting together a client library for RPG should not be that big of a problem and after all it wasn't (except for some stumbling blocks when it came to socket APIs).

The client library is available as an ILE service program written in RPG at its project website hosted on Bitbucket.

Sending Data

A common format should be chosen for the data which is sent to the messaging system. Currently JSON and XML are very common and easy to process formats.

Basically the following steps are needed to send data to a messaging system:

Create an instance of the STOMP client:

client = stomp_create('' : 61613);

Connect on the network level (socket connection):


Connect on the application level (STOMP protocol):

stomp_command_connect(client : 'user' : 'pass');

Send the data:

stomp_command_send(client : '/queue/items' : '{ "id":5500 , "price":1.29 }');

Disconnect on the application level (STOMP protocol):


Disconnect on the network client (close socket connection):


Clean up and free all allocated memory:


At the moment all data is sent as ASCII. The STOMP protocol (at least in its recent version) also supports other encodings but that is not implemented yet (contributions are welcome =) ).


The API documentation has been created with ILEDocs and can (soon) be viewed here.


The project repository has an examples folder which contains some code on how to use the procedures.

There is also a complete demo project available on Bitbucket which shows how to use the procedures.


If you need any help with setting things up or on how to use the service program feel free to contact me at .


Tags : STOMP