locked
MsmqIntegrationBinding using Xamlx

    คำถาม

  • I have setup a XAMLX based Workflow Service hosted in IIS which works great with netMsmqBinding configuration. This service picks up messages from the MSMQ and processes them correctly. The messages are sent to the queue by a WCF client auto-generated by Visual Studio 2010.

    I'd like to set the MQ message priority from the client before sending this message so that the WCF service processes higher priority messages first. I realized that this is not possible using netMsmqBinding hence I am trying to now switch to msmqIntegrationBinding based endpoint for this service.

    The 'Receive' activity intercepts a System.ServiceModel.MsmqIntegration.MsmqMessage<Int32> Message and sets its value to a variable in the XAMLX.

    Now, when I add the Service reference to the client for this updated XAMLX, I get an auto generated 'Reference.cs' with a partial class of type 'MsmqMessageOf_Int32' which is the input parameter for the ServiceContract.

    I'd want to create a MsmqMessage<Int32> object in the client, set its message priority and then use the ServiceContract to schedule this operation by passing it a Msmqmessage object as parameter. Obviously, with the auto-generated service contract, this is not possible as it expects a custom type 'MsmqMessageOf_Int32' as input which is an empty class.

    What am I doing wrong? Is msmqIntegrationBinding not supported in XAMLX?

    13 มีนาคม 2555 13:10

ตอบทั้งหมด

  • I worked with MSMQ's message priority property just using the System.Messaging.MessageQueue in .NET. WCF basically is a layer over top of the underlying MSMQ technology.

    I checked here http://msdn.microsoft.com/en-us/library/system.servicemodel.msmqintegration.msmqintegrationmessageproperty.aspx and it says to use the MsmqMessageIntegrationProperty to set the MSMQ properties. I am a little confused about how the service chose to use MsmqMessage<Int32>. Is this something you specified for the receive shape?

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

    15 มีนาคม 2555 17:09
  • Ben - thanks for your reply.

    You're right. In my XAMLX, I have a Receive Activity which has the Operation name 'ScheduleJob' and its Content definition is a Message of type 'MsmqMessage<Int32>'. AFAIK, there are only 2 valid Types that I can use with msmqIntegrationBinding i.e. MsmqMessage<T> or System.Messaging.Message. For any other data type (including MsmqIntegrationMessageProperty) in the Receive activity, when I access the MEX of the service, I see an exception like

    The MsmqIntegrationBinding validation failed. The service cannot be started. The MsmqIntegrationBinding binding does not support the method signature for the service operation ScheduleJob in the IMsgService contract. Correct the service operation to use the MsmqIntegrationBinding.

    On the client side, when I generate the proxies using Visual Studio 2010 | Add Service Reference, I get the auto-generated partial class which is quite useless as its type is not MsmqMessage<T>.

    For the client, I've also tried to directly use MSMQ and drop a message in the queue instead of going via WCF channels. When I do that (i.e. send a MsmqMessage<Int32> object via MsmqQueue.send), I get a serialization exception which complaints that in type MsmqMessage<T> the AdministrationQueue property of type System.Uri is not serializable (as it has no parameterless constructor). This clearly suggests that MsmqMessage<T> is itself not serializable although it appears to be marked as such. Btw, this kind of exception is also thrown if I set the 'Known Types' collection property of the Receive activity on the server side to include MsmqMessage<Int32>.

    So the net of all this is that there is no working way to activate a WorkflowActivity by using msmqIntegrationBinding and controlling the property of the MQ messages sent. Ughhh.

    Were you able to make this work using some other trick?

    16 มีนาคม 2555 8:36
  • I was going off the example of just using WCF with the MsmqIntegration binding at http://msdn.microsoft.com/en-us/library/ms751490.aspx and then attempting to port this to a WF service. I have not been successful quite yet. It should be possible to use another type other than Int32 for the type. I was able to create a class called PurchaseOrder and specify this for the type but I have a few WF errors to work through. I think the action property on the operation contract / receive shape is important.

    I will let you know if I get this to work.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

    17 มีนาคม 2555 0:59
  • Hi,

    I am following up this thread. I'm actually looking for HOW to create WF service which should be a listener to MSMQ services. In my case also, the client which is giving message to MSMQ is not WCF based. It's actually using System.Messaging. So, thought of using MsMqIntegrationBinding. But looking for the step-by-step approach to create client and WF service and that should be hosted in IIS as listener service. So, can you please help me by providing STEP-BY-STEP details?

    Thanks in advance.

    16 พฤษภาคม 2555 16:09