Changing System Queue Provider from MSMQ to IBM MQ

During the server installation, you must select a System queue provider between Microsoft™ Message Queue (MSMQ) and IBM MQ. After the installation, you can change the provider from MSMQ to IBM MQ.

Before you begin

  • You must have IBM MQ installed, and the connection must be reachable on a server. Refer to Installing IBM MQ for instructions.
  • You need a user with administrator privileges to run PowerShell commands.
Attention:
  • Back up your databases to avoid potential data loss or corruption. For more information on the back up process, see Create a Full Database Backup 🡥.
  • The following procedure won't migrate existing messages on queues. All messages in existing queues will be lost.

Procedure

This topic covers the following tasks:

Starting and stopping the API site

  1. Open the PowerShell application with administrator privileges.

  2. Enter the following command to import the WebAdministration module:

    Import-Module WebAdministration
    
  3. Enter the following command to get the site name of the API:

    Get-Website
    

If you want to start the API site, enter Start-Website -Site $siteName.

If you want to stop the API site, enter Stop-Website -Site $siteName.

Make sure to replace $siteName with your API site name.

Changing the system queue provider from MSMQ to IBM MQ

  1. Stop all IBM RPA Agent Service on all clients.

  2. Stop the API site.

    DECLARE @QueueProviderId UNIQUEIDENTIFIER;
    DECLARE @QueueName NVARCHAR(MAX)
    DECLARE @QueueAddress NVARCHAR(MAX)
    DECLARE @QueuePort INT
    DECLARE @QueueProviderType INT
    DECLARE @MsServerName AS NVARCHAR(MAX)
    DECLARE @MsmqQueueType INT
    DECLARE @IbmQueueManager NVARCHAR(MAX)
    DECLARE @IbmChannel NVARCHAR(MAX)
    DECLARE @IbmCipherSpec INT
    DECLARE @IbmSslName NVARCHAR(MAX)
    DECLARE @IbmTlslName NVARCHAR(MAX)
    DECLARE @IbmUserId NVARCHAR(MAX)
    DECLARE @IbmUserPassword NVARCHAR(MAX)
    
    SET @QueueName = 'SystemMqProviderKey' -- Don't change this
    
    -------------------------------------------------------------
    -------------- CHOOSE ONE CONFIGURATION TO SET --------------
    SET @QueueProviderType = 0 -- 0: for IBM MQ | 5: for MSMQ
    
    SET @QueueAddress = '<MQ FQDN/DNS>' -- MQ IP/FQDN
    SET @QueuePort = NULL -- MQ Port, set this ONLY if it is not installed on the default port
    
    SET @MsServerName = '.' -- Don't change this
    SET @MsmqQueueType = 1 -- Don't change this
    
    SET @IbmQueueManager = 'RPASYSTEM'
    SET @IbmChannel = 'RPA'
    SET @IbmCipherSpec = NULL -- Don't change this
    SET @IbmSslName = NULL -- Don't change this
    SET @IbmTlslName = NULL -- Don't change this
    SET @IbmUserId = 'mqm'
    SET @IbmUserPassword = 'PASSWORD'
    -------------------------------------------------------------
    
    SET @QueueProviderId = (SELECT [Id] FROM [dbo].[QueueProvider] WHERE TenantId IS NULL);
    
    IF @QueueProviderId IS NULL
    	BEGIN
    		SET @QueueProviderId = NEWID();
    
    		INSERT INTO [dbo].[QueueProvider] ([Id], [Name], [Address], [Port], [ProviderType], [CreationDate], [IsDeactivated])
    			VALUES (@QueueProviderId, @QueueName, @QueueAddress, @QueuePort, @QueueProviderType, GETDATE(), 0);
    	END
    ELSE
    	UPDATE [dbo].[QueueProvider] 
    	SET [Name] = @QueueName, 
    		[Address] = @QueueAddress, 
    		[Port] = @QueuePort, 
    		[ProviderType] = @QueueProviderType, 
    		[ModificationDate] = GETDATE() 
    	WHERE [Id] = @QueueProviderId;
    
    IF @QueueProviderType = 0  --WHEN IBMMQ PROVIDER
    	BEGIN	
    		DELETE FROM [dbo].[MsMqProvider] WHERE [Id] = @QueueProviderId;
    
    		IF NOT EXISTS (SELECT [Id] FROM [dbo].[IbmMqProvider] WHERE [Id] = @QueueProviderId)
    			INSERT INTO [dbo].[IbmMqProvider] ([Id], [QueueManager], [Channel], [CipherSpec], [SslName], [TlsFriendlyName], [UserId], [UserPassword]) 
    			VALUES (@QueueProviderId, @IbmQueueManager, @IbmChannel, @IbmCipherSpec, @IbmSslName, @IbmTlslName, @IbmUserId, @IbmUserPassword);
    		ELSE
    			UPDATE [dbo].[IbmMqProvider] 
    			SET [QueueManager] = @IbmQueueManager, 
    				[Channel] = @IbmChannel, 
    				[CipherSpec] = @IbmCipherSpec, 
    				[SslName] = @IbmSslName, 
    				[TlsFriendlyName] = @IbmTlslName,
    				[UserId] = @IbmUserId,
    				[UserPassword] = @IbmUserPassword
    			WHERE [Id] = @QueueProviderId;
    	END
    ELSE IF @QueueProviderType = 5 --WHEN MSMQ PROVIDER
    	BEGIN 
    		DELETE FROM [dbo].[IbmMqProvider] WHERE [Id] = @QueueProviderId;
    
    		IF NOT EXISTS (SELECT [Id] FROM [dbo].[MsMqProvider] WHERE [Id] = @QueueProviderId)
    			INSERT INTO [dbo].[MsMqProvider] ([Id], [ServerName], [QueueType]) 
    				VALUES (@QueueProviderId, @MsServerName, @MsmqQueueType);
    		ELSE
    			UPDATE [dbo].[MsMqProvider] 
    			SET [ServerName] = @MsServerName, 
    				[QueueType] = @MsmqQueueType 
    			WHERE [Id] = @QueueProviderId;
    	END
    ELSE
    	THROW 5000, 'Queue Provider type not supported', 1;
    
    --UPDATE [dbo].[Tenant] SET QueueProviderId = @QueueProviderId WHERE [Id] = @TenantId;
    

In versions prior to 23.0.7, you must set the QueuePort to 1414. If the version is above 23.0.7, set the QueuePort to NULL.

  1. Update the following script according to the considerations:
    1. If IBM MQ was installed following the IBM MQ installation documentation, you only need to change 2 parameters in the previous script:
      1. Set QueueProviderType to 0 in order to use IBM MQ.
      2. On QueueAddress, enter the FQDN/DNS address of the server where MQ is installed (either MSMQ or IBM MQ).
    2. If IBM MQ wasn't installed following the IBM MQ installation documentation, reinstall IBM MQ according to the documentation, and proceed with the change.
  2. Run the previous script on the database.
  3. Start the API site.
  4. Log into IBM RPA Control Center.
  5. Go to the Server Parameters menu.
  6. Go to the System queue provider tab.
  7. Set the password in the Password field.
  8. Confirm the password in the Confirm password field.
  9. Click the Save button.
  10. Start the IBM RPA Agent Service on all clients.

Validating the change

After you change the system queue provider, you must check if IBM MQ is working as expected. To validate, you must test the features involving queueing, such as Scheduling, via scripts or bots, and Orchestration.