Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>MSMQ is a Windows platform specific technology to guarantee the delivery of messages to a specific destination. WCF has 2 bindings which can read/write directly to/from MSMQ, without the need for specific code - just configuration.</p> <p>WCF offers 2 binding strategies:</p> <ul> <li>NetMsmqBinding - a push/pull directly to/from MSMQ</li> <li>MsmqIntegrationBinding - a push/pull directly from a COM/COM+ component</li> </ul> <p>To use MSMQ and WCF together is actually very straight forward. From inserting into MSMQ, you do not even need a concrete implementation on the WCF. A simple example would be:</p> <pre class="lang-cs prettyprint-override"><code>namespace WcfServices { // Interface is only required for MSMQ [ServiceContract] public interface ISendTextService { [OperationContract(IsOneWay=true)] public void Write(string text); } } </code></pre> <p>To hook this up to a configuration file you would do:</p> <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt; &lt;system.serivceModel&gt; &lt;bindings&gt; &lt;netMsmqBinding&gt; &lt;!-- exactlyOnce="false" allows you send multiple MSMQ messages from the channel instance --&gt; &lt;binding exactlyOnce="false"&gt; &lt;!-- Remove security requirements for testing --&gt; &lt;security mode="None"/&gt; &lt;/binding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;!-- Address format requires net.msmq prefix and no $ sign --&gt; &lt;!-- The MSMQ 'test' must also already exist for this to work --&gt; &lt;endpoint address="net.msmq://localhost/private/test" binding="netMsmqBinding" contract="WcfService.ISendTextService" /&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>This deals with the sending to MSMQ. A client app can then do something like:</p> <pre class="lang-cs prettyprint-override"><code>public class TestMsmq { static void Main(string[] args) { var factory = new ChannelFactory&lt;WcfService.ISendTextService&gt;(); var channel = factory.CreateChannel(); // This is required so that they can all be committed together using(var scope = new TransactionScope(TransactionScopeOption.Required)) { channel.SendText("Hello, world!"); channel.SendText("Hello, world! - Part 2"); channel.SendText("Hello, world! - Part 3"); scope.Complete(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload