You are building a solution that processes orders from an online commerce site and must deliver those messages to an ERP system via an MSMQ queue. To send messages to the destination queue, you must create a BizTalk Server send port that utilizes the MSMQ adapter. To configure the send port, follow these steps:
Open the BizTalk Administration Console.
Set the Destination Queue property to the queue name that the ERP system accepts messages from, as shown in Figure 1. In this scenario, we are using a queue named ERPCommerceOrder.
Figure 1. Configuring an MSMQ send port
3. How It Works
The BizTalk Server MSMQ adapter allows easy access to messages in MSMQ queues (MSMQ versions 2.0 and 3.0). The adapter relies on the local MSMQ service, which must be installed on the same computer hosting the adapter.
4. MSMQ Send Options
Ordered Delivery: Specifies whether the message order is persisted when delivering messages to the destination queue. This property enables a solution to implement ordered message delivery, although you must also ensure that all the previous processing (including the receipt of the message from the source queue) is handled serially if the order is to be maintained.
You can additionally specify whether the send port should be stopped if errors are encountered when delivering a message to the destination queue. This setting helps enforce a strict ordered delivery requirement, although it has the side effect of completely disabling an interface if a single error occurs. This property is available only via the BizTalk Administration Console, under the Transport Advanced Options grouping of an MSMQ Send Port Properties dialog box. See Figure 2
Encryption Algorithm: Specifies the algorithm used to encrypt messages as they are written to the destination queue. The available values are RC2, RC4, and None. This property results in the Message.UseEncryption and Message.EncryptionAlgorithm properties being set.
Maximum Message Size (in kilobytes): Specifies the maximum size of the message batch to be delivered to the destination queue. The MSMQ adapter will fill the batch with messages from the MessageBox until this setting is reached.
Message Priority: Specifies the priority for delivering messages. This setting is relative to the other send ports within your BizTalk environment. To nullify the functionality of this property, set the priority on all the send ports in your environment to the same value.
Recoverable: Specifies whether messages will be recoverable if errors are encountered during the delivery to the destination queue. When this value is set to True, messages are persisted to disk in between being pulled from the MessageBox and delivered to the destination queue. If errors occur during delivery, messages can be recovered from the disk.
Support Segmentation: Specifies whether the adapter allows large messages (larger than 4MB) to be segmented. This property should be set to True if you have implemented the large message extension—if the adapter attempts to deliver a message larger than 4MB and this property is set to False, an error is thrown and the message is not delivered.
Timeout: Specifies the timeout value for which messages must be delivered (combined with the Timeout Unit property). This value applies only when the Transaction property is set to True. The MSMQ adapter treats messages not delivered within the specified timeout period as error scenarios.
Acknowledgement Type: Specifies the type of acknowledgment to send upon the successful delivery of a message batch to the destination queue. The available acknowledgment types are defined in the System.Messaging.AcknowledgeTypes enumeration. You can select multiple acknowledgment types for this property.
Certificate Thumbprint: Specifies the certificate thumbprint used to attach to the message batch. You can use this certificate thumbprint to authenticate your BizTalk environment as the sender of the messages, helping increase the overall security of your integration solution. The certificate is stored in the System.Messaging.Message.SenderCertificate property.
Transactional: Specifies whether the send port will deliver messages transactionally. This property must be set to True if the destination queue is transactional and False if the destination queue is not transactional.
If the Transactional property is set to True, the MSMQ adapter transactionally retrieves the appropriate amount of messages (as defined by the Maximum Message Size property) into a batch from the MessageBox and attempts to deliver the batch to the queue within the transaction. If any errors are encountered when delivering the batch (including a timeout, as defined by the Timeout and Timeout Unit properties), the MSMQ adapter attempts to redeliver the messages. If any errors are encountered when redelivering the batch, MSMQ suspends the messages, leaving them in a recoverable state in the MessageBox. Setting this property to True automatically implements the behavior defined by the Recoverable property. Messages within a batch are handled individually—those messages that do not encounter errors are delivered to the destination queue, even if other messages in the batch have errors.
If the Transactional property is set to False, the MSMQ adapter retrieves the appropriate number of messages (as defined by the Maximum Message SizeTimeout and Timeout Unit properties), the MSMQ adapter attempts to suspend the messages. If any errors are encountered when suspending the batch, the messages are lost. property) into a batch from the MessageBox and attempts to deliver the batch to the queue. If any errors are encountered when delivering the batch (including a timeout, as defined by the
5. MSMQ Queue Name Formats
To successfully send documents to an MSMQ queue, you must appropriately format the name of the queue via the Destination Queue property. The appropriate name depends on the type and location of the queue. The following list defines the way the Queue property should be entered for the commonly implemented queues:
Public queue: ComputerName\QueueName
Private queue: ComputerName\Private$\QueueName
Direct access to a queue via HTTP: DIRECT=http://ComputerName/MSMQVirtualDirectory/QueueName, where MSMQVirtualDirectory is the Internet Information Services (IIS) virtual directory name of the MSMQ service
Journal queue: ComputerName\QueueName\Journal$
Dead letter queue: ComputerName\Deadletter$
Transaction dead letter queue: ComputerName\XactDeadletter$