Building Qpid-Proton (AMQP) library for Linux Devices

Published on November 2, 2015

Qpid Proton is a high-performance, lightweight messaging library, which is based on the AMQP 1.0 standard. The Service Bus offered by Windows Azure supports AMQP protocol, that ensures communication between clients developed on different platforms. So, even if we are working on a non-Microsoft system, using Qpid-Proton we can get connected to Microsoft Azure IoT services like Event Hubs and Service Bus.
This page would serve as a guide to build the Qpid-Proton Python package using Yocto build system. We are going to use the Python bindings on the Ankaa our eSOMiMX6 based reference design, so that we can write a simple script to run via the Bridge library, instead of a C program that we would need to cross-compile.
Some of the depend packages already included with image are: Openssl, Python, Cmake, Ossp-uuid, libevent and Make.

Step-by-step guide
1. Downloaded qpid-proton_0.4.bb recipe file from “Qpid-proton-0.4 recipe“. The receipe file is that of the older version of Qpid-proton, yet it could be used to check the format & necessities to build Qpid and by modifying it we could install the newer version of the package.
2. We could also create a new recipe file and configure the appropriate values to build the package. To develop a new recipe, follow the steps given in “Writing a New Recipe

3. Made a new folder as “qpid-proton” inside “meta-esomimx6/recipes-connectivity/”, where we are going to keep the Qpid-proton recipe file.

4. Moved the qpid-proton_0.4.bb file into that directory, changed it name as ” qpid-proton_0.10.bb”.

5. Modified the source_uri to the package path of the current version: Qpid-Proton_0.10.
Necessary md5sum value and sha256sum values were added to download the source package.
Note: The qpid-proton-0.10.bb file is attached below and a brief explanation of the variables used there were also given as a separate file.

6. Added the depend files in the recipe file. These are the list of build time dependencies for a given recipe and indicate recipes that must have staged before our recipe can configure.
As already the recipes related to build Qpid (openssl and python) are present in our yocto build folder, the remaining necessary files like swig and cyrus-sasl were included as DEPENDS.
Note: The Receipe packages “Swig” and “Cyrus-sasl” must be built ready, before building Qpid. Those packages are already present as recipes in the yocto build system and can be build using bitbake command.
$ bitbake swig
$ bitbake cyrus-sasl

7. Then Qpid was build from the “build-esom” directory using bitbake command
$ bitbake qpid-proton

8. Now copied the generated contents of Qpid from the “/usr” folder found inside “build_esom/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/qpid-proton/0.10-r2/image/” to the “/usr” folder rootfs of Ankaa
$ sudo cp -r ~/build_esom/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/qpid-proton/0.10-r2/image/usr/* /media/rootfs/usr/

These are the steps to build the Qpid-proton receipe for Ankaa.

Using this Qpid-proton, event data from Event hubs were successfully retrieved in Ankaa using a sample python receive script provided with qpid-proton package. The sample test script “recv.py” can be found in “/usr/share/proton-0.10/examples/python/messenger/” folder in Ankaa.

Sample Usage: python recv.py

amqps://<username>:<password>@<namespace>.servicebus.windows.net/<queue_name>/ConsumerGroups/<Consumer_Group>/Partitions/<Partition_number>

eg: python recv.py amqps://fullaccess:NrvQf92pXdWnJEj3x0FavBzz9Hf5VpJn3IxtZ8FLzWU=@assettracking.servicebus.windows.net/assettracking/ConsumerGroups/myassettracker/Partitions/13

Related links
a) Qpid-proton-0.4 receipe file: https://git.digitalstrom.org/dss-oe/dss-oe/tree/1d5e6e75e68db967043951b46260c3d8afefb910/yocto/dS/meta-digitalstrom-devel/recipes-support/qpid-proton

b) Writing a New Recipe: http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#new-recipe-writing-a-new-recipe

c) Qpid-Proton latest version(0.10): http://www.us.apache.org/dist/qpid/proton/0.10/qpid-proton-0.10.tar.gz

Recently Published