Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSMQ configuration tutorial #84

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added configuration/new_queue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added configuration/private_queues.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 32 additions & 1 deletion configuration/using-sql-server-with-msmq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,45 @@ 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:

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#
Expand Down
Binary file added configuration/windows_features.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.