The MSMQSender component is used to send messages to MSMQ. The component supports different formatters that can format the incoming messages in a form recognizable by the various client applications to receive. The name of the queue to which a message needs to be sent can be specified using the CPS.
Points to note
- If a queue specified in the CPS does not exist in a local or remote MSMQ server, it is not automatically created.
- This component runs only on Windows Platform.
- This component requires Microsoft .NET Framework 2.0 or above installed on the machine where peer server is running.
- The component sends a message of string type when object Type property is set to false, When the message is to be sent in a particular object type, that object type must confirm to the XMLSerializer. Hence the component supports sending messages of types that can be serialized/deserialized using XMLSerializer. For more information on XMLSerializer, refer: http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx
Configuration
The MSMQ server, queue and formatters can be configured in the CPS.
Managed Connection Factory
Figure 1: Sample MSMQ server configuration
Use Connection Details From Input
If enabled, it will use the connection details from the input request. If the Connection property is not specified in input, then the value provided in this panel will be used.
Connection Configuration
Server Name
Name of the server to be used for communicating with the Queue Manager.
Provide MachineName in case of OS protocol, IP Address in case of TCP protocol and NetworkNumber; HostNumber in case of SPX. IP address or full DNS name of the host computer (or the computer name within an enterprise) in case of HTTP/HTTPS
Queue Name
Name of the Queue to which a component needs to be connected to.
Queue Type
Name of the Queue to which a component needs to be connected to; choose form the following options available:
- private
- public
Protocol
Protocol to be used to retrieve/send messages from/to MSMQ server. Use 'OS' to access with Machine Name and 'TCP' to access with IP Address. To use HTTP/HTTPS MSMQ HTTP Support should have been installed during MSMQ installation.
Options available are:
- OS
- HTTP
- HTTPS
- TCP
- SPX
Transaction
Specifies whether the queue is transacted or not. If this property is enabled, it represents a transacted operation; each message will be wrapped in a transaction while sending.
Connection Pool Params
Please refer the respective section in Common Configurations page.
Interaction Configurations
Monitoring Configuration
Scheduler Configuration
Please refer the respective section in Common Configurations page.
Error Handling
Please refer Error Handling section Common Configurations page for details.
Message Properties
Apart from the above CPS properties, certain other properties can be set as JMS header properties on the incoming message to the component which will be set to the message being sent to the queue. All these properties should be of string type:
- MSMQ_CORRELATION_ID: Sets the message identifier to reference the original message.
- MSMQ_MESSAGE_LABEL: Sets an Unicode string that describes the message
- MSMQ_PRIORITY: Sets the message priority, which determines where in the queue the message is placed. It can take the values from 0 to 7.
- MSMQ_TTL: Sets the maximum amount of time for the message to reach the queue. The message is discarded without input into queue, if that time interval is exhausted. Time interval must be in milliseconds
- MSMQ_USE_JOURNAL_QUEUE: Sets a value that indicates whether a copy of the message should be kept in a machine journal on the originating computer.
- MSMQ_USE_DEADLETTER_QUEUE: Sets a value that indicates whether a copy of the message that could not be delivered should be sent to a dead-letter queue.
Input Schema
Scenario 1
When 'Use Connection from input' is disabled and there is no schema set XSD of message body
In this case, There is no schema that the Input port requires. The input message can simply be any plain text
Scenario 2
When 'Use Connection from input' is disabled and there is a schema set XSD of message body
In this case, The Input port requires the message to be in XML format and it must confirm to the XSD set inside the CPS
Figure 2: Input Schema When Use Connection from input is disabled and there is a schema set XSD of message body
Scenario 3
When 'Use Connection from input' is enabled and there is no schema set XSD of message body
In this case, The Input port requires the message to be in XML format and it should contain all the Connection-configuration values. The XSD for the message is generated automatically and it has an element defined for each property of the CPS. For any value not specified in the input message, the values set inside the CPS will be taken by default
Figure 3: Input Schema When Use Connection from input is set to Yes and there is no schema set XSD of message body
Scenario 4
When 'Use Connection from input' is enabled and there is a schema set XSD of message body
In this case, The Input port requires the message to be in XML format and it should contain all the Connection-configuration values along with the XSD required for the message body. The XSD for the message is generated automatically and it has an element defined for each property of the CPS along with an element "Body" which contains the XSD of the message body. For any value not specified in the input message, the values set inside the CPS will be taken by default.
Figure 4: Input Schema When Use Connection from input is enabled and there is a schema set XSD of message body
Functional Demonstration
Scenario
Send messages to a local MSMQ Server.
Configure the MSMQ Sender in scheduling mode and provide required assemblies for XMLMessageFormatter and use Display component to check the response.
Figure 5: Demonstrating Scenario 1 with sample output
Figure 6: Sample Output