MsmqIntegrationBinding in WCF

The MsmqIntegrationBinding differs from the NetMsmqBinding in that the MsmqIntegrationBinding provides direct integration between Windows Communication Foundation and MSMQ. With NetMsmqBinding, MSMQ is the transport and communicates with other WCF applications, whereas with MsmqIntegrationBinding your WCF application communicates directly with an MSMQ deployment.
The benefit here is that your MSMQ installation will not need to be modified to be able to communicate with your WCF application. Plug-n-play, baby.

MsmqIntegrationBinding Properties

The following table is a list of attributes, and their descriptions, that are available to be used with the MsmqIntegrationBinding.

Attribute Description
closeTimeout A time interval value, which must be greater than zero, that specifies the amount of time for a close operation to complete. The default value is 1 minute (00:01:00).
customDeadLetterQueue A string value that contains a URI that specifies the location of expired messages or messages that have failed delivery.
deadLetterQueue A string value that contains a URI that specifies the location of the dead letter queue.
Durable A Boolean value that specifies whether a message is durable or unstable in the queue.
exactlyOnce A Boolean value that specifies whether each message processed by this binding is only delivered a single time.
maxImmediateRetries An integer value that specifies the maximum number of retry attempts per message that is ready from the application queue. These retries are immediate. The default is 5.
maxReceivedMessageSize Specifies the maximum size of a message, including headers. The number is specified in bytes with a default value of 65536. If a message is larger than the value specified, the sender receives a SOAP fault message and the receiver drops the message and creates an event in the trace log.
maxRetryCycles An integer value that specifies the maximum number of retry cycles used by the poison message feature. A message becomes poisoned when it fails all delivery attempts. The default is 3.
Name A unique string value that contains the configuration name of the binding.
openTimeout A time interval value that specifies the amount of time a message has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
poisonMessageHandling Allows the service to enable or disable poison message handling. Valid values are Disabled and EnabledIfSupported. The default is EnabledIfSupported.
recieveTimeout A time interval value that specifies the amount of time a receive operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
rejectAfterLastRetry A Boolean value that specifies the action to be taken for a failed message delivery after the maximum number of retries. True signifies a negative acknowledgment is sent to the sender and the
message is dropped. False signifies that the message is sent to the poison queue. The default is False.
retryCycleDelay A time interval value that specifies the minimum time delay between retry cycles for failed message delivery. Value should be greater than zero. Default is 10 minutes (00:10:00).
sendTimeout A time interval value that specifies the amount of time a send operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
serializationFormat The format used for message body serialization. Attribute is of type MsmqMessageSerializationFormat.
timeToLive A time interval value that specifies the amount of time a message is valid before it expires and is sent to the dead letter queue. Default is 1 day (1.00:00:00).
useMsmqTracing A Boolean value that specifies whether messages processed by this binding should be traced. The default value is False.
useSourceJournal A Boolean value that specifies whether copies of process messages should be stored in the source journal. The default is False.

The following example illustrates some of the properties being configured in a configuration file:

<system.serviceModel>
  <bindings>
    <msmqintegrateBinding>
      <binding name = “msmqintegratebind” durable = “true” retrycycledelay = “00:00:10” usesourcejournal = “false”>
      </binding>
    </msmqintegrateBinding>
  </bindings>
</system.ServiceModel>

The same can be done through code, as illustrated here:

MsmqIntegrationBinding mib = new MsmqIntegrationBinding();
mib.Durable = true;
mib.RetryCycleDelay = 10000;
mib.UseSourceJournal = false;
Tagged . Bookmark the permalink.

Leave a Reply