How to access locally installed RabbitMQ server within the docker container

How to access locally installed RabbitMQ server within the docker container

book

Article ID: KB0071815

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for AMQP 6.2.0

Description

While creating a connection between the container and non-container RabbitMQ Server (locally installed), the users may face the below error:-

******
 <CausedBy> com.tibco.bw.runtime.ActivityLifecycleFault: TIBCO-BW-PALETTE-AMQP-500015: Error occurred while attempting to create connection: Connection refused (Connection refused)..
   <CausedBy> java.net.ConnectException: Connection refused (Connection refused)
*******
Please refer the resolution section to find the details to fix this issue.

Issue/Introduction

This KB article will help the users for configuring a connection between the locally installed latest 'RabbitMQ server' and the docker container on the same machine successfully.

Environment

All OS

Resolution

In the latest versions of RabbitMQ, the by default "guest" user is prohibited from connecting from remote hosts; it can only connect over a loopback interface (i.e. localhost). Hence, the above error "Connection refused" will be there while attempting a connection between the locally installed RabbitMQ server with the docker container.

For more information, please refer to the below URL from the RabbitMQ:-
====
https://www.rabbitmq.com/access-control.html
====
To resolve this issue, create any 'new user' with administrator access in the RabbitMQ. For creating a new user, please follow the below steps using the rabbitmq command prompt (sbin directory)

Step 1:- Add a new/fresh user, say user test and password test
[command] rabbitmqctl add_user test test

Step 2:- Give administrative access to the new user:

[command] rabbitmqctl set_user_tags test administrator

Step 3:- Set permission to newly created user:

[command] rabbitmqctl set_permissions -p / test "." "." ".*"

After successfully creating a new user, follow the below steps in the BWCE.

Step 1:- Create an AMQP connection resource and select the BrokerType as " RabbitMQ"

Step 2:- In the HostPort tab of the connection resource, for the 'Host' provide the 'IP address' or complete 'Hostname' of your machine where the RabbitMQ Server has been installed and its respective port number.

Step 3:- Please make sure to provide the newly created User and its Password in the "Username and Password tab " of the AMQP connection resource.

Step 4:- Click on the "Test Connection" tab to ensure the test connection successful.

After performing the above steps, the user will be able to run an AMQP project within the docker container successfully.