This project is in continuation of a blog post I did some months back on how to use hornetq and STOMP. Now I wanted to contrast what I did for hornetq with A-MQ. I’ll be using the same STOMP/python code I wrote for hornetq.
Download A-MQ
https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=jboss.amq&productChanged=yes [jboss-a-mq-6.1.0.redhat-379]
Note
|
You can also use apache’s activeMQ, which are roughly equivallant |
Install
$ unzip /jboss-amq/installers/jboss-a-mq-6.1.0.redhat-379.zip
Configure
- Add user
$ echo "admin=admin,admin" >> ./jboss-a-mq-6.1.0.redhat-379/etc/user.properties
- Add authentication
-
uncomment the following lines
$ vim ./jboss-a-mq-6.1.0.redhat-379/etc/system.properties ... activemq.jmx.user=admin activemq.jmx.password=admin ...
- Create Broker
$ cp ./jboss-a-mq-6.1.0.redhat-379/etc/activemq.xml ./jboss-a-mq-6.1.0.redhat-379/etc/activemq-stomp.xml
- Add stomp connector
$ vim ./jboss-a-mq-6.1.0.redhat-379/etc/activemq-stomp.xml
...
<transportConnectors>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>
</broker>
- Update A-MQ broker reference
$ vim ./jboss-a-mq-6.1.0.redhat-379/etc/org.fusesource.mq.fabric.server-default.cfg
...
config=${karaf.base}/etc/activemq-stomp.xml
...
- Start server
$ ./jboss-a-mq-6.1.0.redhat-379/bin/start
https://github.com/jasonrbriggs/stomp.py
Note
|
Get additional implemetations here http://stomp.github.io/implementations.html |
$ python3 msg-send-recv.py
enter topic name, e.g. jms.topic.spin :topic.helloworld
enter MQ useradmin
Password:
Enter server ip, e.g. 192.168.122.170 :192.168.122.170
on_connecting 192.168.122.170 61613
on_send STOMP {'accept-version': '1.1', 'passcode': 'admin', 'login': 'admin', 'host': 'example.com'}
on_connected {'version': '1.1', 'heart-beat': '0,0', 'server': 'ActiveMQ/5.8.0.redhat-60024', 'session': 'ID:irs.example.com-36888-1416341937814-2:1'}
on_send SUBSCRIBE {'id': 1, 'ack': 'auto', 'destination': 'topic.helloworld'}
on_send SEND {'destination': 'topic.helloworld'} b'the current time is: 15:19:40'
on_before_message {'message-id': 'ID:irs.example.com-36888-1416341937814-2:1:-1:1:1', 'priority': '4', 'subscription': '1', 'expires': '0', 'timestamp': '1416341980900', 'destination': '/queue/topic.helloworld'} the current time is: 15:19:40
on_message {'message-id': 'ID:irs.example.com-36888-1416341937814-2:1:-1:1:1', 'priority': '4', 'subscription': '1', 'expires': '0', 'timestamp': '1416341980900', 'destination': '/queue/topic.helloworld'} the current time is: 15:19:40
on_send DISCONNECT {'receipt': 'fd346f9c-3de6-478b-bd7f-2635eba64ecc'}
on_disconnected