Questions tagged [msmq-wcf]

WCF can communicate directly with MSMQ, whether you intend to read/write from/to MSMQ. WCF also allows the plug-in of MSMQ-like COM/COM+ components.

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.

WCF offers 2 binding strategies:

  • NetMsmqBinding - a push/pull directly to/from MSMQ
  • MsmqIntegrationBinding - a push/pull directly from a COM/COM+ component

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:

namespace WcfServices
{
  // Interface is only required for MSMQ
  [ServiceContract]
  public interface ISendTextService
  {
    [OperationContract(IsOneWay=true)]
    public void Write(string text);
  }
}

To hook this up to a configuration file you would do:

<configuration>
  <system.serivceModel>
     <bindings>
       <netMsmqBinding>
         <!-- exactlyOnce="false" allows you send multiple MSMQ messages from the channel instance -->
         <binding exactlyOnce="false">

           <!-- Remove security requirements for testing -->
           <security mode="None"/>
         </binding>           
     </bindings>
     <client>
       <!-- Address format requires net.msmq prefix and no $ sign -->
       <!-- The MSMQ 'test' must also already exist for this to work -->
       <endpoint address="net.msmq://localhost/private/test"
                 binding="netMsmqBinding"
                 contract="WcfService.ISendTextService" />    
     </client>
   </system.serviceModel>
 </configuration>

This deals with the sending to MSMQ. A client app can then do something like:

public class TestMsmq
{
  static void Main(string[] args)
  {
     var factory = new ChannelFactory<WcfService.ISendTextService>();
     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();
     }
  }
}
55 questions
1
vote
1 answer

Messages not getting picked up from a queue having underscore in its name

I have a WCF service QueuedService.TicketingService.svc hosted in IIS under application name QueuedService_1_1. So the complete URL for the service is: http://example.com/QueuedService_1_1/QueuedService.TicketingService.svc The service is having a…
sth
  • 146
  • 8
1
vote
1 answer

Multiple messages removed from MSMQ

I have a certain service that runs over WCF and MSMQ. Everything works fine but we have this requirement which says that if something unexpected happens during processing of one job, it should not affect any other. The service is designed to be…
memory of a dream
  • 1,207
  • 3
  • 23
  • 32
1
vote
2 answers

MSMQ - can I query messages which are currently being processed?

I'm using WCF with MSMQ endpoints and am seeing the behaviour described in this question - basically although the service is throttled to process one message at a time, 2 messages are taken from the queue, with one seemingly held in memory while the…
Pete S
  • 265
  • 2
  • 11
1
vote
0 answers

How to get msmq message "received" when queue is set to Authenticated?

I'm using WCF 4.0 and the service is hosted in IIS (WAS), with a net.msmq address. I'm starting out by simply sending an int through a method. In my web.config I have the following. Note- I can't hook to AD because of other restrictions. Even…
1
vote
0 answers

WCF and MSMQ - Transforming message body loses complex parameter

I am trying to send a message via WCF and MSMQ and apply a transformation to the message content before it is sent. I can capture the message in the BeforeSendRequest event of a Client Message Inspector, grab the message as xml and apply an Xslt…
Brann
  • 11
  • 1
1
vote
1 answer

MSMQ on windows server 2008

I installed MSMQ on windows server 2008 in workgroup mode. I noticed there is only a private queue and a public queue is missing. It causes I can't send message from remote computers. I see the messages in outgoing queues. the state is "Waiting to…
Hadas
  • 10,188
  • 1
  • 22
  • 31
1
vote
2 answers

design high volume MSMQ

We have many communication servers sending data packets. We would like to store these data packets coming from these server programs in MSMQ until an updater will process them. Data loss has been a concern and we would like to not lose any data…
user180175
  • 23
  • 8
0
votes
2 answers

Given net.msmq Address, How Do I Check if this Queue Exists?

I have a service, which inserts stuff into MSMQ via WCF. However, it can be a long time before any messages are inserted into the queue, which is when the error for a non-existing queue would occur. My idea is to loop through the WCF configuration…
Mas
  • 4,546
  • 5
  • 39
  • 56
0
votes
0 answers

how can i test remoted MSMQ as a production environment

I designed an application that relies on sending and receiving messages in MSMQ remotely, my problem is I wanna test this in stress environment in which all devices sending and receiving as fast as possible and simultaneously so the issue is I…
0
votes
1 answer

MSMQ - how to Communicate between two application

I started looking into MSMQ very recently so i have basic doubts . If two application needs to communicate lets say server and client I think both will share the same MQ address and when the client update then the Server will be having the MSMQ…
satish
  • 2,425
  • 3
  • 23
  • 40
0
votes
1 answer

MSMQ requires AD certificate, but we are using a service account

Issue: How do you create the AD certificates MSMQ requires of an AD account, which are auto-created per computer in AD upon first login, without actually logging on as said account? Background: We are using WCF + MSMQ for a project. The "MSMQ…
Bill
  • 51
  • 3
0
votes
1 answer

Can a WCF service object implementing a contract for a net.msmq endpoint also implement a callback contract for a net.tcp endpoint?

Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however when I use a single service object to implement the net.msmq endpoint for reading from the underlying queue, and a net.tcp endpoint for listeners to…
andrewbadera
  • 1,372
  • 9
  • 19
0
votes
1 answer

How can my WCF service recover from unavailable message queue?

I have a WCF service that receives messages from the Microsoft Message Queue (netMsmqBinding). I want my service to recover if the message queue is unavailable. My code should fail to open the service, but then try again after a delay. I have code…
Andrew Shepherd
  • 44,254
  • 30
  • 139
  • 205
0
votes
1 answer

Delete a message from OUTGOING QUEUES in msmq

Is it possible to delete a message from outgoing queues? I don't see any option for deleting. How to delete these messages? I am new to msmq. I am trying to send messages from my computer to some other computer. All my messages are sitting in…
user2995902
  • 49
  • 1
  • 8
0
votes
0 answers

Maximum no. of concurrent connections exceeded for SmtpClient

I have a scenario, An MSMQ queuing system...Records are queued on a timely basis...A WCF listener that listens to the queue, starts processing the records as soon as the records are queued up...does some process and sends email after that(There are…
Sumit Roy
  • 413
  • 2
  • 9
  • 23