# ActiveMQ & Websocket ## Goal - ActiveMQ for production. - Websocket over activeMQ setup ## TL;DR - Available docker image configuration is not sufficient for our need. So, we need to have a manual config files. (Need some time to explore the activeMQ configuration). - I tried to have manual config files for activeMQ, but doesnt work. (like STOMP protocol is inactive, web console is inactive, although I already overide the config files). ## ActiveMQ Configuration current docker image : https://github.com/disaster37/activemq There are some **parameters** that we can adjust, this image is working fine but **not sufficient** for our needs. ``` version: "3.6" services: # 61616 is for openwire # 61613 is for stomp # 8161 is for admin console (web) # Pulsar amq: image: webcenter/activemq:latest container_name: janactivemq environment: - ACTIVEMQ_REMOVE_DEFAULT_ACCOUNT=true - ACTIVEMQ_ADMIN_LOGIN=admin - ACTIVEMQ_ADMIN_PASSWORD=adminpassword - ACTIVEMQ_ENABLED_AUTH=true - ACTIVEMQ_READ_LOGIN=consumer_login - ACTIVEMQ_READ_PASSWORD=consumer_password - ACTIVEMQ_WRITE_LOGIN=producer_login - ACTIVEMQ_WRITE_PASSWORD=producer_password volumes: - /data/activemq:/data/activemq - /var/log/activemq:/var/log/activemq ports: - "6161:61616" - "8180:61613" - "8188:8161" ``` - We need a user that has **authorize to write and read the the same time**. But that user **doesn't have access to the web console**. - The above docker image seem **only support user for write or read** (1 user 1 role/group) ### alternative docker image : https://github.com/rmohr/docker-activemq - I tried to load default configuration. it works fine, but the basic feature is not active, like **web console**. default conf: http://svn.apache.org/repos/asf/activemq/trunk/assembly/src/release/conf/ ``` version: "3.6" services: # 61616 JMS # 8161 UI # 5672 AMQP (since `rmohr/activemq:5.12.1`) # 61613 STOMP (since `rmohr/activemq:5.12.1`) # 1883 MQTT (since `rmohr/activemq:5.12.1`) # 61614 WS (since `rmohr/activemq:5.12.1`) amq: image: rmohr/activemq:latest container_name: janactivemq volumes: - /data/activemq:/data/activemq - /var/log/activemq:/var/log/activemq - /home/jan/docker-active-mq/conf:/opt/activemq/conf ports: - "6161:61616" - "8180:61613" - "8188:8161" ``` - I already read and modified the configuration (activate STOMP and WS protocols) but some feature still not working (python can't connect to STOMP). ```xml <transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> </transportConnectors> ``` Problems: ## Activemq for production - I used this image https://github.com/rmohr/docker-activemq. But only success until change admin password, auth connection. But still failed on creating a new using with READ and WRITE role (1 user for 2 roles). - The manual configuration hasn't been successful. seem more complicated and need some time to explore. ## Websocket over ActiveMQ - The available docker images don't have parameter to activate WS over activeMQ, we need to load the our own config file to activate WS over activeMQ. The config files is exist but the activeMQ is not running properly (as the config file). ### Websocket over activeMQ (Q&A) - I don't have enough knownledge on this, so may need some guidances. - If we use WS over activeMQ, - How do we manage the connection manager? (1 device 1 connection) - How do we implement authentication? - How the clients connect to the MQ through WS (is it same as we connect regular WS?) Ref: http://activemq.apache.org/websockets.html