diff --git a/configuration/new_queue.png b/configuration/new_queue.png new file mode 100644 index 0000000..6e88198 Binary files /dev/null and b/configuration/new_queue.png differ diff --git a/configuration/private_queues.png b/configuration/private_queues.png new file mode 100644 index 0000000..f5baa24 Binary files /dev/null and b/configuration/private_queues.png differ diff --git a/configuration/using-sql-server-with-msmq.rst b/configuration/using-sql-server-with-msmq.rst index d6ff45e..11d6a68 100644 --- a/configuration/using-sql-server-with-msmq.rst +++ b/configuration/using-sql-server-with-msmq.rst @@ -24,7 +24,7 @@ MSMQ support for SQL Server job storage implementation, like other Hangfire exte PM> Install-Package Hangfire.SqlServer.Msmq -Configuration +Microsoft Message Queuing (MSMQ) Configuration -------------- To use MSMQ queues, you should do the following steps: @@ -32,6 +32,37 @@ To use MSMQ queues, you should do the following steps: 1. **Create them manually on each host**. Don't forget to grant appropriate permissions. Please note that queue storage is limited to 1048576 KB by default (approximately 2 millions enqueued jobs), you can increase it through the MSMQ properties window. 2. Register all MSMQ queues in current ``SqlServerStorage`` instance. +To create a new Queue you must first install MSMQ on your windows machine: + +1. At a command prompt, run the command OptionalFeatures to open the 'Windows Features' dialog. +2. In the feature tree of the dialog, Check the top-level feature 'Microsoft Message Queue (MSMQ) Server'. This also checks the sub-feature 'Microsoft MessageQueue (MSMQ) Server Core'. The dialog should look like this: + +.. image:: windows_features.png + +3. Windows displays a dialog to say "Please wait while Windows makes changes to features. This might take several minutes." Wait until the dialog disappears. + +Now to create a queue: + +1. Right click on “My Computer” → Manage → Services and Applications → Message Queueing: + +.. image:: private_queues.png + +2. Right click on Private queues (here is how to create public ones – https://technet.microsoft.com/en-us/library/cc776346(v=ws.10).aspx), New, Private Queue, give name, check the Transactional: + +.. image:: new_queue.png + +3. And then configure Hangfire: + +.. code-block:: c# + + var sqlServerStorage = new SqlServerStorage( + @"Server=.\sqlexpress;Database=Hangfire.Sample;Trusted_Connection=True;"); + sqlServerStorage.UseMsmqQueues(@".\Private$\hangfire-{0}", "default"); + + +Configuration +-------------- + If you are using **only default queue**, call the ``UseMsmqQueues`` method just after ``UseSqlServerStorage`` method call and pass the path pattern as an argument. .. code-block:: c# diff --git a/configuration/windows_features.png b/configuration/windows_features.png new file mode 100644 index 0000000..f853700 Binary files /dev/null and b/configuration/windows_features.png differ