cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Using RabbitMQ Management plugin with ThingWorx Flow

Regular Member

Using RabbitMQ Management plugin with ThingWorx Flow

The RabbitMQ Management plugin provides a web-based interface into the inner workings of the messaging bus behind ThingWorx Flow. It is installed by the Flow installers but is an HTTP service by default and is a totally different web server than the NGINX used to front-end ThingWorx Flow. This will describe how to integrate it into the NGINX on your ThingWorx Flow server. This is necessitated by some recent browser behavior changes that make it very hard to get to the http port once you've used an https service on the same machine from the same browser.

 

First - let's find the user name and password for the RabbitMQ Management plugin.

On a Linux server, the file /etc/rabbitmq/definitions.json will hold the name and password for the plugin's UI:

        "users": [{

                "name": "flowuser",

                "password": "1780edc6b8628ace2ace72465cdc7b048c88",

                "tags": "administrator"

        }],

 

On a Windows server, the definitions.json file can be found under [flow install location]\modules\RabbitMQ.

 

Of course, access to these directories should be limited.

 

Second - let's integrate the plugin into NGINX

The best way to integrate the plugin into Flow is to let NGINX reverse proxy to the other http server running the UI for the plugin, which is exactly what happens for Thingworx itself. That way, only NGINX has to be configured for https and no other ports need to be opened to allow access to the plugin.

 

You need to find the file vhost-flow.conf on your system. On Linux, this will be /etc/nginx/conf.d/vhost-flow.conf.

On Windows, it will be at C:\Program Files\nginx-[version]\conf\conf.d\vhost-flow.conf by default. Add the following fragment after the last location xxx {…} segment in the file:

 

    # deal with the rabbitMQ admin tool

    location ~* /rabbitmq/api/(.*?)/(.*) {

        proxy_pass http://127.0.0.1:15672/api/$1/%2F/$2?$query_string;

        proxy_buffering                    off;

        proxy_set_header Host              $http_host;

        proxy_set_header X-Real-IP         $remote_addr;

        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

    }

 

    location /rabbitmq {

        rewrite ^/rabbitmq$ /rabbitmq/ permanent;

     }

 

    location ~* /rabbitmq/(.*) {

        rewrite ^/rabbitmq/(.*)$ /$1 break;

        proxy_pass http://127.0.0.1:15672;

        proxy_buffering                    off;

        proxy_set_header Host              $http_host;

        proxy_set_header X-Real-IP         $remote_addr;

        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

    }

 

This makes the request for /rabbitmq get pushed over to the web server at port 15672 on the Flow server.

 

Test the updated config file with (nginx may not exist in your normal path):

nginx -t

 

Restart the NGINX service:

Linux (one of these will work depending upon your Linux version):

systemctl restart nginx

service nginx restart

Windows:

Net stop ThingWorxOrchestrationNginx

Net start ThingWorxOrchestrationNginx

-or- use the Services app to restart the service

 

Thanks to https://groups.google.com/forum/#!topic/rabbitmq-users/l_IxtiXeZC8 for the needed config changes.

 

You can now use https://yourserver/rabbitmq to get to the login page for the management plugin. Login with the user and password from the definitions.json file on your system and you can now monitor the behavior of your RabbitMQ environment.

Announcements