Solved

WCF Service That Responds to Messages Arriving in MSMQ

Posted on 2013-10-23
10
170 Views
Last Modified: 2015-01-28
Hi all

I can't figure out how to set this up. I can post messages into my MSMQ with no issues, however I cannot figure out how to setup/build a WCF service that is invoked whenever a new queue item appears…

I've got a WCF service with the interface setup thus :

[OperationContract(IsOneWay=true)]
void ReadQueue(TQueueItem myQueueItem);

And the service itself is :

public void ReadQueue(TQueueItem myQueueItem))
  {
     Some code in here that processes myQueueItem
  }

myQueueItem is basically a custom class that I attach to my MSMQ message.

I've then got an Application added under the Default Website with netMsmqBinding setup on it. The service itself is configured as per Tom Hollanders blog :

http://blogs.msdn.com/b/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx

I'm developing using VS2012 on a Windows7 machine. Just trying to get it running locally first.

I've got MSMQ setup on my local machine and have a number of queued messages in the queue I'm hoping my WCF service will process.

I must be missing something somewhere. Does anyone have a walkthrough that shows all the configuration steps? I'm pulling my hair out!
0
Comment
Question by:raynera
  • 6
  • 4
10 Comments
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39596359
Simply putting it... you can't!

Webservices, like webpages, are designed to wait for actions, not to start them.
An outside entity must perform a request to a WCF Service for it to work, otherwise it will never start or do things by himself.

What you need is actually a windows service that will periodically check the MSMQ.
Then you can make this windows service call an hypothetical ProcessMQ() method of the WCF that reads and processes all messages in the queue.
0
 

Author Comment

by:raynera
ID: 39596565
I thought that's what the Windows Activation Service was for? To be able to kickstart a WCF service when something lands in a queue? At least that's what I'd got from reading stuff on the web :/

If that assumption is wrong too I'll do what you say...and write a plain old windows brokering service.
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39596673
Oh snap... I completely forgot about WAS.
But if you're going on that route I can't really help you because I never actually implemented anything with it.

Anyway... I think I still like the idea of developing my own windows service instead :)

Good luck!
0
 

Author Comment

by:raynera
ID: 39604205
I guess I stumped everyone? Don't want to write a brokering service :(
0
 

Accepted Solution

by:
raynera earned 0 total points
ID: 40557290
Long time since I posted this question...anyways I very recently managed to solve it. The internet finally caught up with me - someone posted an example that worked!
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Closing Comment

by:raynera
ID: 40566000
Found a solution online.
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 40566044
As you accepted your own answer, can you post your solution (not just a link)?

As it stands, this question is pretty much useless to anyone.

Thanks!
0
 

Author Comment

by:raynera
ID: 40566121
Do I take it that you need the solution to the problem? Or are you just being picky?!
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 40566215
I'm being picky :)

In my opinion either we delete the question of if there's an accepted answer it should in fact represent an answer.
As it stands, someone that bumps into this gets no added value.
0
 

Author Comment

by:raynera
ID: 40576329
Yeh I know. When I get chance to package it up I'll do it.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now