I covered how to install Apache Artemis on IBM i in the last part of this series. Now we need a way to connect to Artemis from our ILE environment as this is the main environment in classic SMB IBM i shops.
Lets take one step back and have a look at the internet where many different platforms and programming languages work together. HTTP is one of the main pillars of the world wide web. It is a rather simple protocol (at least version 1.0 and 1.1) which can be implemented in probably any programming language.
There is something similar in the messaging world: STOMP - Simple Text Orientated Messaging Protocol. It has many similarities with HTTP and is also easy to implement. And most messaging middlewares support this protocol and so does Artemis. We already configured one acceptor in Artemis especially for the RPG client in the previous post. The acronym STOMP hints that the protocol can only be used with text message but that is not the case. You can also use STOMP for sending binary data.
Luckily there is already an RPG implementation of the STOMP 1.2 protocol ready to use at RPG Next Gen. It has been conveniently packaged for an easy installation with iPKG. We just need to install the iPKG client (just download the save file and restore the two objects) and are good to go to install the STOMP service program and the corresponding RPG copybooks for all the prototypes.
iPKG is an ILE program and command and can be executed from the 5250 terminal session.
First we need to create a library where we want to install the objects. Then we need tell iPKG where to look for packages. We do this by registering the RPM repository from RPG Next Gen.
iPKG needs to download and process the meta data from this repository. This is done by executing
The STOMP service program has the following software packages as dependencies:
- Linked List
All these packages are included in the RPG Next Gen RPM repository and can be installed with iPKG.
ipkg install linkedlist
After successfully installing the dependencies we can install the STOMP service program.
ipkg install stomp
For using the STOMP service program we need the prototypes and constants of the STOMP project. These are provided as copybooks in stream files and are packaged for iPKG available in the RPG Next Gen RPM repository.
Packages which contain stuff necessary for development like prototypes and header files have
the suffix “-devel“ like stomp-devel. By default the stream files will be extracted to the
/usr/local/include. But we can also specify a different location with the parameter
ipkg install 'stomp-devel' loc('/home/mihael/include')
Now we have everything we need for building our first program with the STOMP service program.
For everybody with an IBM i server with no or restricted access to the internet: iPKG can also be used offline. You will still need to get the RPM packages from the internet (either the single packages or the whole repository). But you can do this yourself and put the repository or packages on the IFS on your IBM i server or host these packages somewhere inside your network on a web server.
The RPM repository at RPG Next Gen offers the repository packaged for offline usage. Once you have extracted the repository from the archive file you can use it with the iPKG command and install packages as usual.
You first need to register the repository and update the meta data.
ipkg addrepo 'RPGNextGen file:///home/user/repository'
Now you are free to install any packages you need from this repository just by using the package name on the install command.
ipkg install stomp
The other option is to download the packages you are interested in one by one to the IFS and
install them. The
install command not only accepts a package name but also a RPM file name
and a path to a RPM file. The RPG Next Gen RPM repository lists the available packages in the
RPM Packages section.
If you placed the RPM files at
/home/user/rpm and want to install the package STOMP version
2.0.0-2 you can execute the following command.
ipkg install '/home/user/rpm/stomp-2.0.0-2-ppc-ibmi-7.2.rpm'
If you have a couple of packages you want to install by this way you can first change the
current directory with
CHGCURDIR '/home/user/rpm' and then just state the file name on
the install command like this:
ipkg install 'stomp-2.0.0-2-ppc-ibmi-7.2.rpm'
Of course you can also compile the STOMP project yourself. It is not too hard but requires some effort as you need to also manually compile the dependencies in the correct version.
Feel free ;-)
All the shown iPKG commands expect that we use the library
IPKG as our target library. If we
want to use another library for this we can add the parameter
IPKGLIB(MY_TST_LIB) to all
ipkg commands. You can use as many libraries with different repositories and/or installed
packages as you like. Each target library is self-contained and does not mess with any other
All service programs provided by the RPG Next Gen RPM repository will automatically be added
IPKG binding directory. The binding directory is located in the library specified in
When installing packages with objects from the QSYS.LIB file system iPKG will execute a
command. The user installing the packages needs to have enough authorities to use this command.