Question

J'ai une configuration de service de flux de travail activé par WCF (XAMLX) (hébergé à l'aide de WorkflowServiceHost).

Ce site Web WCF a une liaison «NetMSMQBinding» et un point final basé sur Net.MSMQ qui est utilisé par les clients pour planifier des opérations.

du côté du client, j'ai utilisé Visual Studio pour générer le talon de proxy pour communiquer à ce service WCF.Tout fonctionne bien et je peux voir les messages figurant dans mon (journalé) MQ sur le serveur et le WCF ramassant des messages à partir de la file d'attente pour activer le workflow configuré en fonction du message.

Je dois contrôler la priorité des messages envoyés à MQ afin que certains clients de la WCF puissent obtenir le traitement priorisé de leurs flux de travail.

Il semble que NetMsmqBinding ne prend pas vraiment en charge la priorisation des messages MQ.Est-ce correct?Si oui, comment puis-je obtenir / simuler cela?Puis-je utiliser des déclencheurs MQ pour changer la priorité des messages basés sur certains indicateurs?

Était-ce utile?

La solution

Posting my solution, in case someone needs to figure this out

NetMSMQBinding does not support setting message priority from the client side so I was using the wrong binding. The more powerful MsMqIntegrationBinding is the right way to go.

Client side: From the client side, one needs to simply create a System.Messaging.Message object, set the priority and drop it in the MessageQueue.MessageQueue object which points to the destination MQ.

Server side: The WorkflowService hosting WCF project needs the following endpointBinding in the web.config:


<endpoint address="msmq.formatname:DIRECT=OS:.\private$\MyWebService/MyProcessingService.xamlx" binding="msmqIntegrationBinding" bindingConfiguration="MyMsMqIntegrationBinding" contract="IMyProcessingService" name="MqIntegrationBindingEndPoint" />

(the address is assuming MQ service is local to the WCF hosted)

<bindings> <!--We use msmqIntegrationBinding instead of netMsmqBinding since we want to control priority of MQ messages being dropped in the queue and that is not supported in netMsmq --> <msmqIntegrationBinding> <binding name="MyMsMqIntegrationBinding" exactlyOnce="false"> <security mode="None" /> </binding> </msmqIntegrationBinding>


The way to receive the MsmqMessage from the MQ and process it is by dropping a "Receive" activity in the XAMLX and choosing Message as the Content definition MessageType as System.ServiceModel.MsmqIntegrationMessage<YourTypeGoesHere> Now you'll have access to this MsmqMessage<yourType> from your ActivityContext where you can retrieve the value sent in the message.

This is a very useful and powerful way to build a scalable, throttled with priority control MQ+WCF+WF based web service

Autres conseils

Are these transactional messages? If so, you cannot change the priority at all.

Messages are immutable so you can't change the priority of a non-transactional message that has already been sent.

Cheers
John Breakwell

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top