12

I'm looking to gain a better understanding of why it is recommended to never Publish() messages from a website using NServiceBus (NServiceBus Documentation, scroll about two thirds of the way down).

Doesn't it make semantic sense to Publish() events, and to Send() commands? If so, I think it makes sense that a web application can both Publish() and Send() :-)

Also, given that using Publish() doesn't require the web application to know about the recipients of the messages (Send() requires the web application to have all recipient endpoints configured), it feels like Publish() is a better option for many scenarios so that you can 'arbitrarily' subscribe applications to message queues.

Does anyone have strong feelings about this, one way or another? I'd love to hear your thoughts and opinions.

1 Answer 1

18

Disclaimer: I wrote this blog post.

Why not publish NServiceBus messages from a web application?

3
  • thanks for the blog link. another reason why you would not want to publish a message from a website is because it would then need to have an subscriptionstorage. typically this would be a database. Jan 13, 2011 at 8:21
  • Thank you David. Your blog post provides a really thorough answer to my question. I am building a web app which is not quite 'dumb' like you described - but it's close. I'm new to NServiceBus (obviously) so I'll wade in slowly, but I'll take the advice that I should in fact use Bus.Send() because what I'm trying to achieve is to get a long-running process kicked off. Later on I can hopefully make the rest of the web-app 'dumber' by introducing NServiceBus at all my command boundaries. Thanks!
    – Øyvind
    Jan 13, 2011 at 9:18
  • David, I've posted another, relevant question here: stackoverflow.com/questions/4678721/…. Would you mind having a look at this if you have a minute? Many thanks, Øyvind
    – Øyvind
    Jan 13, 2011 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.