DC 5.5 RabbitMQ

This is a brief description of RabbitMQ in relation to Digizuite. It's really important that you only change the RabbitMQ configuration if the customer specifically asks for it. 

RabbitMQ documentation: https://www.rabbitmq.com/documentation.html

NServiceBus RabbitMQ documentation: https://docs.particular.net/transports/rabbitmq/

Break down of RabbitMQ's relation to Digizuite:

  1. RabbitMQ is multi-tenant and can be structured in a concept called Virtual Hosts (https://www.rabbitmq.com/vhosts.html).

  2. Digizuite utilizes the Virtual Host concept to separate queues, exchanges, and bindings between systems from each other. This allows you to utilize an existing RabbitMQ queue as an example so that systems on the same server can be separated on the same server and with a vhost in RabbitMQ for each of them systems.

    In the RabbitMQ Management Studio (usually on localhost:15672) you can get info on all virtual hosts:


  3. For each vhost, we create a publish queue and some subscription queues. Right now there is a sub-queue for the DC and one for all other services; such as audit and AI.



  4. To exchange messages between queues, we use the conventional routing topology as per NServiceBus (https://docs.particular.net/transports/rabbitmq/routing-topology) rather than the Direct Routing with routing keys as originally preferred. The reason for this is that conventional routing takes into consideration the inheritance aspect and will therefore generate all exchanges for all interfaces as illustrated below:


Configuration

In almost all cases you won't have to do any configuration for RabbitMQ. The Digizuite installer will automatically install RabbitMQ and start it up on http://localhost:15672. This is the default (connection string format: host=localhost;username=user;password=password;virtualhost=uniqueDbName).

If you wish to utilize other than localhost, it is important that you create your own vhost with the RabbitCLI which is calculated using the code shown below. This is important because the services utilize this unique database name to connect to the correct vhost.

Furthermore, setting the correct user privileges for that vhost is also crucial. As an example of this, you would need to do the two following steps to create a vhost and set privileges with the RabbitMQ CLI:
rabbitmqctl.bat add_vhost $uniqueDbName 
rabbitmqctl.bat set_permissions -p $uniqueDbName guest ".*" ".*" ".*"


Next step is to construct and provide your host connection string for RabbitMQ to the Digizuite DAM Center and Digizuite Core Services

  1. A configurable RabbitMQ connection string. Formatted like this: host=localhost;username=guest;password=guest;virtualhost=uniqueDbName
  2. This must be set in two places
    1. DAM Center app settings in web.config.

      <appSettings>
            <add key="rabbitMqConnectionString" value="host=localhost;username=guest;password=guest;virtualhost=uniqueDbName" />
            ......
      </appSettings>

    2. Digizuite Core services appsettings.json (...[yourDC]/DigizuiteCore/appsettings.json): 

      "RabbitMQ": {        
           "ConnectionString": "host=localhost;username=user;password=password;virtualhost=uniqueDbName"
      }

Troubleshooting

One thing to be aware of after the installation has been done is the connections in rabbit. Always make sure that you see these two following connections in the management UI: (it's also okay if there are more than two)

*.dam.core.subscriber 

*.dam.core.webhost.subscriber

If you do not see these then recycle the two highlighted app pools in the IIS:


If RabbitMQ is not running then please try to restarting the service by running the following commands in command prompt (in the library C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.8\sbin) :

  1. rabbitmq-service.bat stop
  2. rabbitmq-service.bat install
  3. rabbitmq-plugins.bat enable rabbitmq_management
  4. rabbitmq-service.bat start

After following the above steps, you will experience that the virtual host has been removed. Follow the below steps to correct this (once completed, the queues will be recreated by DAM). Click the image to enlarge it: