Monday, January 10, 2011

Installing activeMQ on IBM i5 V5R4

The project I am working on is written in PHP. Since it is a B2B web service, I want my application to write down both system level log and application level log as much as possible. Then, somebody can analyze the log when they want to.

However, as well known, an I/O operation is a time consuming operation. Obviously, I do not want this logging function will significantly slow down my application. Therefore, I design a asynchronous model to write logs. In order to be asynchronous, I have two choices. The first is multi-threaded. The second is messaging queue. Since PHP does not have built-in support for multi-thread and PHP is stateless, I choose Messaging Queue. I used to lead on migrating from Sonic MQ to ActiveMQ for a ETL engine project. So, I decide to give it a try on IBM i i5 V5R4 platform.

On IBM i i5 V5R4 platform, I have JDK 1.5 32bit, which is IBM J9 VM. Below is the steps I install activeMQ on IBM i5/OS V5R4,

1) run command call qp2term to open a i5/OS PASE terminal session.

2) run java -version to check the JDK version.

3) run export JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk50/32bit to set this session's JAVA_HOME to point to JDK1.5 . or, call command CHGENVVAR ENVVAR(JAVA_HOME) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk50/32bit') to modify the JAVA_HOME environment if i have not in PASE environment. or use ADDENVVAR to add the environment.

4) run java -version to check the JDK version again to make sure your using JDK 1.5 now.

5) Go to http://activemq.apache.org/ and download activeMQ distribution for Unix/Linux/Cygwin platform. I downloaded version 5.4.2 .

6) using 7zip to unzip the file to be a TAR file as I can not use -z option with tar command in PASE environment on i5/OS.

7) copying the tar file under my home directory on i5/OS via IFS.

8) running command tar -xvf apache-activemq-5.4.2.tar

9) cd into directory "apache-activemq-5.4.2" and run command ./bin/activemq to start up activemq with default configuration.

10) Since I can not control i5/OS and the PASE terminal emulator might has problem with character schema used by JDK in default. I choose to test this activemq instance from my PC workstation.

11) Download and install activemq zip format distribution.

12) set the JAVA_HOME environment properly from either Windows system environment variable setting or adding set JAVA_HOME=%your jdk home directory% into BATCH files.

13) Download and install apache ANT and add ANT bin directory into Windows PATH environment.

14) In windows command prompt window, go to activemq example directory and run command ant producer -Durl=tcp://your_i5_host:11616 to send sample msg into activemq testing channel.

15) In windows command prompt window, go to activemq example directory and run command ant consumer -Durl=tcp://your_i5_host:11616 to consume sample msg inside activemq testing channel.

After the last two steps is successful, I know I can use activeMQ on i5/OS. Although this is not a installation for product environment, it shows me how to install activeMQ under my home directory as developing environment.

3 comments:

  1. Yiyu, thanks for writing this article. It will give people confidence to explore the solutions that are possible on IBM i.

    ReplyDelete
  2. In particular, the step-by-step Java instructions are helpful.

    ReplyDelete
  3. Hi Alan,

    Thank you for your comment! It will encourage me to write more.

    I am interested in ActiveMQ on IBMi because, as far as I know, Zend framework only support STOMP and IBM Webshpere MQ does not support STOMP. So, I think about using activeMQ on IBMi when I planned to implement a php logging system in asynchronous architecture.

    ReplyDelete