Changing System Queue Provider from IBM MQ to MSMQ

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 IBM MQ to MSMQ.

Before you begin

  • You must have MSMQ installed, and the connection must be reachable on a server.
  • You need a user with administrator privileges to run PowerShell commands, and enable Windows Server features, including privileges to enable MSMQ.
Attention:
  • Back up your databases to avoid potential data loss or corruption. For more information on the back up process, seeCreate a Full Database Backup 🡥.
  • This procedure does not migrate existing queues. All messages in any IBM MQ queue will be lost, and the existing queues won't migrate to MSMQ. Refer to Queues for instructions on how to create new queues.

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 IBM MQ to MSMQ

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

  2. Stop the API site.

  3. Run the following script on the database:

    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 = 5 -- 0: for IBM MQ | 5: for MSMQ
    
    SET @QueueAddress = '<MQ FQDN/DNS>' -- MQ IP/FQDN
    SET @QueuePort = NULL -- MQ Port, set this depending on the IBM RPA version. 
    
    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;
    
  4. Start the API site.

  5. Start the IBM RPA Agent Service on all clients.

Validating the change

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

What to do next

If you have already created queues, computers, orchestration processes, or computer groups before migrating to MSMQ, log in to IBM RPA Control Center, edit and save these resources to force the API to re-create queues in MSMQ for these resources.