MSMQ Listeners using WCF












8















Do anybody knows how to implement MSMQ Listeners using WCF ?



i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.










share|improve this question

























  • Can you be more specific?

    – Xhalent
    Oct 12 '11 at 6:19











  • So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

    – Kirk Broadhurst
    Oct 12 '11 at 6:37











  • i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

    – Abhijith Nayak
    Oct 12 '11 at 7:07
















8















Do anybody knows how to implement MSMQ Listeners using WCF ?



i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.










share|improve this question

























  • Can you be more specific?

    – Xhalent
    Oct 12 '11 at 6:19











  • So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

    – Kirk Broadhurst
    Oct 12 '11 at 6:37











  • i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

    – Abhijith Nayak
    Oct 12 '11 at 7:07














8












8








8


6






Do anybody knows how to implement MSMQ Listeners using WCF ?



i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.










share|improve this question
















Do anybody knows how to implement MSMQ Listeners using WCF ?



i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.







c# wcf msmq






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 20 '18 at 16:45









tom redfern

23.8k1062102




23.8k1062102










asked Oct 12 '11 at 6:11









Abhijith NayakAbhijith Nayak

130315




130315













  • Can you be more specific?

    – Xhalent
    Oct 12 '11 at 6:19











  • So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

    – Kirk Broadhurst
    Oct 12 '11 at 6:37











  • i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

    – Abhijith Nayak
    Oct 12 '11 at 7:07



















  • Can you be more specific?

    – Xhalent
    Oct 12 '11 at 6:19











  • So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

    – Kirk Broadhurst
    Oct 12 '11 at 6:37











  • i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

    – Abhijith Nayak
    Oct 12 '11 at 7:07

















Can you be more specific?

– Xhalent
Oct 12 '11 at 6:19





Can you be more specific?

– Xhalent
Oct 12 '11 at 6:19













So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

– Kirk Broadhurst
Oct 12 '11 at 6:37





So much information on SO about this: stackoverflow.com/questions/372935/wcf-and-msmq stackoverflow.com/questions/2154853/msmq-and-wcf-service stackoverflow.com/questions/1526958/msmq-wcf-and-flaky-servers

– Kirk Broadhurst
Oct 12 '11 at 6:37













i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

– Abhijith Nayak
Oct 12 '11 at 7:07





i have 2 wcf services built, 1 for sending data to MSMQ queue and another is called by MSMQ listener when there is an insertion in MSMQ queue.Now i wanna know how and where i need to write this MSMQ listener.

– Abhijith Nayak
Oct 12 '11 at 7:07












1 Answer
1






active

oldest

votes


















4














You do not need to manually implement a queue listener on your service.



Simply by creating your service operation contract you are specifying the handler method which will be called when a message arrives on the local queue.



You probably (or should) have something like this:



[OperationContract(IsOneWay = true, Action = "*")]
void HandleMyMessage (MsmqMessage<String> message);


This will ensure that the method HandleMyMessage() in your service implementation will be called when a message is delivered.



UPDATE



In response to your question in the comment below, to define the queue address you can do this in the <System.ServiceModel> configuration:



<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- Define NetMsmqEndpoint -->
<endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted"
binding="netMsmqBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor" />
<!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>


From here: http://msdn.microsoft.com/en-us/library/ms789032.aspx






share|improve this answer


























  • Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

    – Abhijith Nayak
    Oct 12 '11 at 9:08











  • Where do you specify queuename, to which i need to listen?

    – Abhijith Nayak
    Oct 12 '11 at 10:52











  • See my update to the question

    – tom redfern
    Oct 12 '11 at 18:19











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7735965%2fmsmq-listeners-using-wcf%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














You do not need to manually implement a queue listener on your service.



Simply by creating your service operation contract you are specifying the handler method which will be called when a message arrives on the local queue.



You probably (or should) have something like this:



[OperationContract(IsOneWay = true, Action = "*")]
void HandleMyMessage (MsmqMessage<String> message);


This will ensure that the method HandleMyMessage() in your service implementation will be called when a message is delivered.



UPDATE



In response to your question in the comment below, to define the queue address you can do this in the <System.ServiceModel> configuration:



<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- Define NetMsmqEndpoint -->
<endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted"
binding="netMsmqBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor" />
<!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>


From here: http://msdn.microsoft.com/en-us/library/ms789032.aspx






share|improve this answer


























  • Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

    – Abhijith Nayak
    Oct 12 '11 at 9:08











  • Where do you specify queuename, to which i need to listen?

    – Abhijith Nayak
    Oct 12 '11 at 10:52











  • See my update to the question

    – tom redfern
    Oct 12 '11 at 18:19
















4














You do not need to manually implement a queue listener on your service.



Simply by creating your service operation contract you are specifying the handler method which will be called when a message arrives on the local queue.



You probably (or should) have something like this:



[OperationContract(IsOneWay = true, Action = "*")]
void HandleMyMessage (MsmqMessage<String> message);


This will ensure that the method HandleMyMessage() in your service implementation will be called when a message is delivered.



UPDATE



In response to your question in the comment below, to define the queue address you can do this in the <System.ServiceModel> configuration:



<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- Define NetMsmqEndpoint -->
<endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted"
binding="netMsmqBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor" />
<!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>


From here: http://msdn.microsoft.com/en-us/library/ms789032.aspx






share|improve this answer


























  • Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

    – Abhijith Nayak
    Oct 12 '11 at 9:08











  • Where do you specify queuename, to which i need to listen?

    – Abhijith Nayak
    Oct 12 '11 at 10:52











  • See my update to the question

    – tom redfern
    Oct 12 '11 at 18:19














4












4








4







You do not need to manually implement a queue listener on your service.



Simply by creating your service operation contract you are specifying the handler method which will be called when a message arrives on the local queue.



You probably (or should) have something like this:



[OperationContract(IsOneWay = true, Action = "*")]
void HandleMyMessage (MsmqMessage<String> message);


This will ensure that the method HandleMyMessage() in your service implementation will be called when a message is delivered.



UPDATE



In response to your question in the comment below, to define the queue address you can do this in the <System.ServiceModel> configuration:



<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- Define NetMsmqEndpoint -->
<endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted"
binding="netMsmqBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor" />
<!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>


From here: http://msdn.microsoft.com/en-us/library/ms789032.aspx






share|improve this answer















You do not need to manually implement a queue listener on your service.



Simply by creating your service operation contract you are specifying the handler method which will be called when a message arrives on the local queue.



You probably (or should) have something like this:



[OperationContract(IsOneWay = true, Action = "*")]
void HandleMyMessage (MsmqMessage<String> message);


This will ensure that the method HandleMyMessage() in your service implementation will be called when a message is delivered.



UPDATE



In response to your question in the comment below, to define the queue address you can do this in the <System.ServiceModel> configuration:



<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- Define NetMsmqEndpoint -->
<endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted"
binding="netMsmqBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor" />
<!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>


From here: http://msdn.microsoft.com/en-us/library/ms789032.aspx







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 1 at 11:55

























answered Oct 12 '11 at 7:35









tom redferntom redfern

23.8k1062102




23.8k1062102













  • Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

    – Abhijith Nayak
    Oct 12 '11 at 9:08











  • Where do you specify queuename, to which i need to listen?

    – Abhijith Nayak
    Oct 12 '11 at 10:52











  • See my update to the question

    – tom redfern
    Oct 12 '11 at 18:19



















  • Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

    – Abhijith Nayak
    Oct 12 '11 at 9:08











  • Where do you specify queuename, to which i need to listen?

    – Abhijith Nayak
    Oct 12 '11 at 10:52











  • See my update to the question

    – tom redfern
    Oct 12 '11 at 18:19

















Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

– Abhijith Nayak
Oct 12 '11 at 9:08





Thanks a lot hugh. So you mean to say only one service fulfills both send and receive operations right?

– Abhijith Nayak
Oct 12 '11 at 9:08













Where do you specify queuename, to which i need to listen?

– Abhijith Nayak
Oct 12 '11 at 10:52





Where do you specify queuename, to which i need to listen?

– Abhijith Nayak
Oct 12 '11 at 10:52













See my update to the question

– tom redfern
Oct 12 '11 at 18:19





See my update to the question

– tom redfern
Oct 12 '11 at 18:19




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7735965%2fmsmq-listeners-using-wcf%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith