Automatically resend expired MSMQ dead letter messages using QueueMonitor

There were few inquires recently on what to do with messages which were moved by MSMQ to dead letter queue because they reached “Time to be received” timeout.

When is Time to be received property useful?

Sometimes messages are of temporary value and are not important unless they are processed immediately. For instance if we use queue to send current status of some process, next message will anyway be come after few seconds. Even if we stop processing we don’t want to process all pending messages if we’re only interested in latest one. For these scenarios Time to be received makes sense, since MSMQ will automatically remove these messages from queue once timeout is reached. If messages are set to use Dead letter queue, they will be moved to one of two System Dead-letter queues – one for transactional messages and one for non-transactional.

However sometimes reality gets in a way. Sender has some expectations and sets Time to be received to few minutes, but circumstances change and we find out that these messages are still needed and important even if they were moved to dead letter queue.

How to automatically resend messages to their original queue using QueueMonitor

For this to work you’ll need QueueMonitor Professional, since it offers more complex processing.

 

Step 1 – New task

Click on “New Task…” and pick “Process messages – scheduled” task.

QueueMonitor - Select a task

Why scheduled processing? Because dead letter queues can contain messages which came there for various reasons – for instance purged messages, etc. We don’t want to return all of these messages back to their queues, we’re interested only in expired ones. There’s similar task “Process messages – constantly” but it constantly watches a queue and should be used when all arriving messages should be processed as soon as they arrive. If we don’t want to remove all messages after they’re processed, constant processing will be suboptimal because it will keep iterating through queue all the time which could be a problem for system resources.

 

Step 2 – Pick a queue

Choose one of System queues – “Dead letter messages” or “Transactional dead-letter messages”. In you want to monitor both DL queues, you should create two separate tasks because of limitations in current version of QueueMonitor we’ll discuss later.

Select a queue

Step 3 – Schedule

Pick how often you want this task to occur:

Schedule

Step 4 – Message filter

If we want to only resend messages which were expired, we should make appropriate filter:

Message filter for ReceiveTimeout

Turn on Advanced query option, select Acknowledgment property and set it to equals ReceiveTimeout

You can make more complex query here, if you want to process only certain messages.

 

Step 5 – Actions

Change Time to be received

Add Change message properties action and configure it to change “Time to be received” property.

Send to queue action

Add Send to queue action. For destination name type {msg_destination} (you can also insert macros by clicking on M button). This will make sure that message goes back to its original destination.

And here’s a reason why you had to create separate tasks for transactional and non-transactional DLQs. Sending in MSMQ requires that you either wrap it in Transaction or not, depending on type of queue. For local queues QueueMonitor can determine whether queue is transactional, but if it’s remote queue or if macros are used (like in this case), it can’t and you have to set it manually. So if this task is for transactional DLQ check Transactional checkbox, otherwise leave it unchecked.

Step 6 – Done

You can save new task now. In order to read system queues, QueueMonitor service will have to work under account with administrative privileges. If it’s not already set, go to Computer Management, find QueueMonitor service and change it’s Log On as setting.

You can use “Run once now” option to test new task whether it works correctly. If everything is ok, you can enable this task and it will continue to work in background, happily resending all expired messages back to their original queues.

QueueMonitor 1.0 released

Thanks for your feedback and support during beta testing of QueueMonitor! That helped us a lot to reach v1.0.

What’s new for v1.0?

Apart from smaller fixes, there are two significant improvements. First one is import/export of tasks. It makes it easy to configure tasks on one server and transfer them to another one. Or to create backup before you start modifying tasks.

Second improvement is documentation. Whenever you’re creating or editing task you can hit F1 and get help for that specific task.
(more…)

QueueMonitor Beta – monitoring and automation for MSMQ

QueueMonitor Beta is here

Thanks for your support during alpha testing of QueueMonitor! That helped us a lot to reach this point. We are now ready for Beta stage. What does Beta mean in our case? It means QueueMonitor passes our internal tests, doesn’t have any known issues and doesn’t consume much memory or CPU when left running for prolonged periods of time. In other words, it behaves as fully functional software.

Of course, it’s rare that any software survives first contact with real world usage. That’s why we need your help with Beta testing.

(more…)

QueueExplorer 3.3 – Queue views (PRO)

QueueExplorer 3.3 bring queue views for Professional edition.

Queue views allow user to configure how messages are filtered, displayed, etc. on queue by queue basis. Following settings are stored:

  • Which columns are displayed
  • Filtering and sorting
  • Limiting number of messages (i.e. “Top x messages”)
  • .Net viewer assembly path
  • Encodings for body and extension when displayed as a column

(more…)

QueueExplorer 3.0 Standard and Professional released

We released new major version of QueueExplorer. Here’s list of most important new features in QueueExplorer 3.0:

  • Message body is visible at all times, so it’s much easier to check several messages in a queue – body will be automatically displayed as you click on message.
  • Subqueues are supported if QueueExplorer runs on OS which offers that functionality (Windows Vista or higher).
  • Messages can be quickly filtered by any field, or you can even create more complex queries.
  • Performance is improved in several areas. Now it’s realistic to open, select, save or load queues with tens of thousands of messages.
  • New file format is compressed and much smaller than before, and it doesn’t need lot of memory during save/load as prevoius file format did.
  • WCF messages viewer.
  • Color coded XML editor replaced previous read-only XML view.

(more…)

QueueExplorer 2.2.4 – bugfixes and performance improvements

Changes in this release:

  • Faster loading of big files and reduced memory usage
  • Faster display of large XML message bodies
  • Command line option for turning off loading of public queues for performance reasons – /NoPublic
  • Bugfix: message body larger than 64KB was not correctly displayed/edited
  • Bugfix: messages containing byte 0 were not completely displayed in text view.
  • Bugfix: queue list didn’t show all queue properties correctly.
  • Bugfix: on some Vista machines QueueExplorer worked with reduced functionality

QueueExplorer 2.2.3 released

Changes in this release:

  • Queues are now closed immediately after each operation to prevent locking issues with other applications
  • Reduced MSMQ security requirements. QueueExplorer required full MSMQ permissions no matter which operation was performed. Now it will ask only for what’s needed, e.g. Peek to get list of messages, Receive to delete message, etc. Works only on .Net 2.0 or higher
  • Bugfix: More complex class hierarchies in .Net view crashed entire QueueExplorer.