Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Latest commit

 

History

History
140 lines (106 loc) · 4.15 KB

README.md

File metadata and controls

140 lines (106 loc) · 4.15 KB

monkey

Scalable IBM Websphere MQ multi-thread scheduler.

Prerequisites

IBM WebSphere 7.5 is required to build and install the pymqi

Download the mqadv_dev75_linux_x86-64.tar.gz from IBM Website

Following the https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.ins.doc/q115250_.htm

sudo apt-get install rpm pax
mkdir mq75
tar -xvf mqadv_dev75_linux_x86-64.tar.gz -C mq75
cd mq75
mkdir rpms
sudo ./mqlicense.sh -text_only
sudo ./crtmqpkg mqipy
sudo -H TMPDIR=$(readlink -f rpms) ./crtmqpkg mqipy
sudo rpm -ivh --nodeps --force-debian rpms/mq_rpms/mqipy/x86_64/MQSeriesRuntime_mqipy-*.rpm
sudo rpm -ivh --nodeps --force-debian rpms/mq_rpms/mqipy/x86_64/MQSeriesServer_mqipy-*.rpm
for i in rpms/mq_rpms/mqipy/x86_64/*.rpm; do sudo rpm -ivh --nodeps --force-debian $i; done
 
sysctl -w net.ipv4.tcp_keepalive_time=300
echo "net.ipv4.tcp_keepalive_time=300" | sudo tee -a /etc/sysctl.conf > /dev/null
echo "mqm soft nofile 10240" | sudo tee -a /etc/security/limits.conf > /dev/null
sudo su mqm -c "/opt/mqm/bin/mqconfig"

Installation

cd path/to/monkey
pip install path/to/monkey

Running

LD_LIBRARY_PATH="/opt/mqm/lib64" MQSERVER="TEST.CHANNEL/TCP/127.0.0.1(8000)" monkey

Setup a MQ server for testing purposes:

Issue some variables to configure unittests:

source /opt/mqm/bin/setmqenv -s
export MQIPY_TEST_QUEUEMANAGER="TEST.QM"
export MQIPY_TEST_QUEUE="TEST.QUEUE"
export MQIPY_TEST_CHANNEL="TEST.CHANNEL"
export MQIPY_TEST_HOST="127.0.0.1"
export MQIPY_TEST_PORT="8000"

Create and start the QueueManager.

sudo -Humqm /opt/mqm/bin/crtmqm ${MQIPY_TEST_QUEUEMANAGER}
sudo -Humqm /opt/mqm/bin/strmqm ${MQIPY_TEST_QUEUEMANAGER}

Create the queue.

echo "DEFINE QLOCAL (${MQIPY_TEST_QUEUE})" | sudo -Humqm /opt/mqm/bin/runmqsc ${MQIPY_TEST_QUEUEMANAGER}

TCP Listener

Configure the QueueManager to listen on TCP.

echo "
DEFINE CHL(${MQIPY_TEST_CHANNEL}) CHLTYPE(SVRCONN)
DEFINE LISTENER(TCP.LISTENER.1) TRPTYPE(TCP) PORT(${MQIPY_TEST_PORT}) CONTROL(QMGR) REPLACE
START LISTENER(TCP.LISTENER.1)
ALTER QMGR CHLAUTH(DISABLED)
" | sudo -u mqm /opt/mqm/bin/runmqsc ${MQIPY_TEST_QUEUEMANAGER}

Permissions

sudo -Humqm /opt/mqm/bin/setmqaut -m ${MQIPY_TEST_QUEUEMANAGER} -t qmgr -p mqm +all
sudo -Humqm /opt/mqm/bin/setmqaut -m ${MQIPY_TEST_QUEUEMANAGER} -t queue -p mqm -n ${MQIPY_TEST_QUEUE} +all
sudo usermod -aG mqm root
echo "REFRESH SECURITY" | sudo -Humqm /opt/mqm/bin/runmqsc ${MQIPY_TEST_QUEUEMANAGER}

Finally issue the MQSERVER:

export MQSERVER="${MQIPY_TEST_CHANNEL}/TCP/${MQIPY_TEST_HOST}(${MQIPY_TEST_PORT})"
cd /opt/mqm/samp/bin/
./amqsgetc ${MQIPY_TEST_QUEUE} ${MQIPY_TEST_QUEUEMANAGER}

Open another terminal and check the amqsgetc output:

cd /opt/mqm/samp/bin/
echo "HI" | ./amqsputc ${MQIPY_TEST_QUEUE} ${MQIPY_TEST_QUEUEMANAGER}

All together

###############################

source /opt/mqm/bin/setmqenv -s
export MQIPY_TEST_QUEUEMANAGER="TEST.QM"
export MQIPY_TEST_QUEUE="TEST.QUEUE"
export MQIPY_TEST_CHANNEL="TEST.CHANNEL"
export MQIPY_TEST_HOST="127.0.0.1"
export MQIPY_TEST_PORT="8000"
sudo -Humqm /opt/mqm/bincrtmqm ${MQIPY_TEST_QUEUEMANAGER}
sudo -Humqm /opt/mqm/bin/strmqm ${MQIPY_TEST_QUEUEMANAGER}
echo "DEFINE QLOCAL (${MQIPY_TEST_QUEUE})" | sudo -u mqm runmqsc ${MQIPY_TEST_QUEUEMANAGER}
echo "
DEFINE CHL(${MQIPY_TEST_CHANNEL}) CHLTYPE(SVRCONN)
DEFINE LISTENER(TCP.LISTENER.1) TRPTYPE(TCP) PORT(${MQIPY_TEST_PORT}) CONTROL(QMGR) REPLACE
START LISTENER(TCP.LISTENER.1)
ALTER QMGR CHLAUTH(DISABLED)
" | sudo -Humqm /opt/mqm/bin/runmqsc ${MQIPY_TEST_QUEUEMANAGER}
sudo -Humqm /opt/mqm/bin/setmqaut -m ${MQIPY_TEST_QUEUEMANAGER} -t qmgr -p mqm +all
sudo -Humqm /opt/mqm/bin/setmqaut -m ${MQIPY_TEST_QUEUEMANAGER} -t queue -p mqm -n ${MQIPY_TEST_QUEUE} +all
sudo usermod -aG mqm root
echo "REFRESH SECURITY" | sudo -Humqm /opt/mqm/bin/runmqsc ${MQIPY_TEST_QUEUEMANAGER}
export MQSERVER="${MQIPY_TEST_CHANNEL}/TCP/${MQIPY_TEST_HOST}(${MQIPY_TEST_PORT})"

###############################