Message actions

What is an action in QueueMonitor?

Actions allow you to customize how QueueMonitor processes messages. You can choose series of steps in which message is parsed, changed, sometimes depending on content of message or some other condition. At the end it’s usually sent to some other queue, saved database or file, etc.

Tasks which process messages allow you to configure what should be done with each message. Actions are performed one by one sequentially, similar to instructions in standard computer program. Each action has separate settings displayed in right half of window, where you configure in more details how that action should work.

Adding action

Click on Add Action button and select one of available actions.

Managing actions

You can delete, copy or paste actions using Delete button or context menu. You can also reorder actions by dragging them to new position.

Delete message after processing

This option is available only on some types of tasks. If available, it specifies whether message should be deleted from a queue or not after processing is successfully completed. If there was any error during processing, message will not be deleted.

Actions available in both Standard and Professional editions

MSMQ actions

Send to queue
Sends message to a MSMQ queue. Queue can be local or remote. For remote queues you’ll have to manually specify whether queue is transactional or not. You can also specify whether message will be sent as Recoverable, whether system Dead Letter or system Journal should be used, and whether QueueMonitor always uses authentication. For local queues we can detect whether queue is authenticated or not, but for remote we need this check box correctly set up.
Move to subqueue
Moves message to subqueue of source queue.

Save to filesystem actions

You should use Macros to make file names unique.

Save to single .mq file

Save all processed messages to single .mq file. All message properties are saved.

Each time task is run - a new .mq file will be created, unless there are no messages to be processed. If task includes multiple queues, each of them will get separate .mq file.

This action is mostly useful when lot of messages are saved. E.g. when backing up journal.

Save to separate .mq files
Save each processed message to separate .mq file. All message properties are saved.
Save body
Saves message’s body to a file. Other message properties are not saved.<br><br>

Actions available in QueueMonitor Professional only

Modify message actions (PRO)

Find/Replace in Label
Searches and replaces text in message’s label. You can use message Macros to provide values here.
Find/Replace in Body
Changes text in message’s body .You can use message Macros to provide values here.
Change message properties
Change some of message properties: Label, App specific, Body type, Priority, Time to reach queue and Time to be received. Only selected properties will be changed.
Change body encoding
Convert body from one encoding to another. Input encoding can be automatically discovered or specified explicitly.

XML actions (PRO)

XPath Replace
Search and replace within message’s body using XPath. You can use sample XML to help with XPath matching.
XSLT
Perform XSL transformation on message body. You can use sample XML for easier testing of XSLT. Results are immediately displayed in Output XML panel.
Multiple documents from XML
When input message (i.e. body) contains multiple documents, this action can be used to extract individual documents using XPath and process each of them individually. Each part will be put in Body field, which you can process with additional actions if needed.

Custom value actions (PRO)

These actions allow you to extract data from message body, and use extracted value in later actions as s Custom values. You can select whether value will be treated as a String, Int or Double. This affects how value is used in queries. The Value name you choose here will be visible with other macros and you can use it wherever macro can be used.

Custom value from XML
Extract value from XML using XPath.
Custom value from JSON
Extract value from JSON using JSON selector.

If/Else conditional actions (PRO)

Perform one set of actions if condition was true, or another one if it was false. It’s allowed to nest If/Else constructs. You can drag and drop actions to specify which should be executed when condition is true (Then section) or false (Else section).

If (Query) Then/Else
Evaluates a query for each message. Query can include standard and custom Macros values.
If (XPath) Then/Else
Evaluates XPath for each message. If there is a match in message’s XML, Then section will be executed. Otherwise actions under Else will be executed.

External Integration actions (PRO)

FTP Send
Sends message to FTP server. You should specify Server address, whether to use plain FTP, FTP over SSL or SFT. For remote folder and file name you can use macro values.
SQL

Execute SQL. You can INSERT message content into database, UPDATE some records or execute any other SQL. In order to perform SQL, you have to define at least one connection to SQL Server, by clicking Manage connection(s) button. Connections are global, so you can reuse them through multiple tasks and actions. Result of SQL can be saved as Custom values macro and used for other actions.

How to pass parameters to SQL Server?

One way is to embed them directly in SQL. You can use all available macros there. However, to avoid SQL injection issues, when you don’t know whether input data is clean and in which format it is, it’s better to use SQL Parameters section. Instead of putting direct macro value in SQL text, use @value_name there, and then add that value_name to list of parameters in bottom grid. That way parameters are transferred separately from SQL text.

Invoke EXE
Invokes executable program. You can pass any of message or custom macro fields as command line arguments.
Web request
Sends HTTP request to web server. You can use macro values as a part of URL, or add them to table of parameters. Parameters from table will be added to Url for GET method, or sent as form results for POST method. Result from HTTP call can be stored to custom macro to be used in later actions.