WCF Service to read Message from MSMQ Automatically


I need to write a WCF service should read message from MSMQ automatically whenever it is available in the Queue. Can some one provide me the examples?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Does this really make sense?
mynetquestionsAuthor Commented:
Hi ste5an,

What would be the best way to read a message automatically from MSMQ through WCF service?
ste5anSenior DeveloperCommented:
A WCF service reading messages from a queue like MSMQ automatically, means that you will lose messages. Thus the question: really automatically?

Maybe you can describe your context and give us more information..
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Aaron JabamaniTechnical ArchitectCommented:
MSMQ has triggers. When ever a message arrives, it can trigger the exe. The exe can then read all the messages from the MSMQ, until it reads all the message in the MSMQ.

When  you are creating the MSMQ, you can set the triggers.
ste5anSenior DeveloperCommented:
A queue is a reliable message store in MSMQ. Where is the sense, to let a WCF service poll it, when that service may not be called from a consumer? Then messages may be lost in the WCF service.

This is what I think, automatically means. And why I don't think it's a good idea.

The question is: Dear @op, what do you really like to do?
Perhaps what you really need is a regular Windows Service (not WCF) that reads from MSMQ and does whatever needs to be done with the messages.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.