scarpacci scarpacci - 4 days ago 9
C# Question

WCF MsmqIntegrationBinding

Do messages pulled off an

MSMQ
queue have to be added to the queue via a process using
MsmqIntegrationBinding
in order for a
WCF
Service to pick them off the queue using
MsmqIntegrationBinding
? We have a legacy process that is writing an
xml
payload to a queue using
System.Messaging
and when I run my process to try and pick the message off the queue nothing happens (Meaning the message stays in the queue). I was just wondering if a message is enqueued using another process can you still use
WCF / MsmqIntegrationBinding
to dequeue the message?

I know that ideally you should use DataContracts and
NetMsmqBinding
, but unfortuantely in this situation we don't have the ability to modify the process enqueing the messages.

As I am sure you can tell I am still very ignorant with
WCF / MSMQ
so maybe the solution is simple.

Any suggestions would be greatly appreciated.

Thanks,

S

Answer

MsmqIntegrationBinding can use different formatters to read/write data to the queue. This can be done by setting the serializationFormat property of your binding. For example, to interoperate with an ActiveX client you set the serializationFormat to ActiveX. To interoperate with a .net client set it to Xml.

<service name="MyQueueListenner">

    <!-- Active X endpoint -->
    <endpoint address="msmq.formatname:DIRECT=OS:.\private$\myQueue"
              binding="msmqIntegrationBinding"
              bindingConfiguration="ActiveXBinding"
              contract="MyContract" />

    <!-- .Net endpoint-->
    <endpoint address="msmq.formatname:DIRECT=OS:.\private$\myOtherQueue"
              binding="msmqIntegrationBinding"
              bindingConfiguration="DotNetBinding"
              contract="MyContract" />

  </service>
  ...

  <msmqIntegrationBinding>
    <binding serializationFormat="ActiveX" name="ActiveXBinding" durable="false" exactlyOnce="false">
      <security mode="None" />
    </binding>
    <binding serializationFormat="Xml" name="DotNetBinding" durable="false" exactlyOnce="false">
      <security mode="None" />
    </binding>
  </msmqIntegrationBinding>

This allows you the full range of formatters providing the greatest range of interoperability with your queue clients.

The full list of values is here: http://msdn.microsoft.com/en-us/library/system.servicemodel.msmqintegration.msmqmessageserializationformat.aspx

Comments