﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Alex,
  
You have to hit the server for that.
  
A background updater using ajax would do the trick
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment29</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment29</guid><pubDate>Sat, 07 Jun 2008 04:18:05 GMT</pubDate></item><item><title>Alex commented on Request/Reply vs. Pub/Sub</title><description>Is there anyway this requirement can be done for an aspx page
  
  
The requirement is that the user wants to see the list of available candidates for a position, but that that list should be updated to show the current status at all times. In other words, if a new candidate joins the system 10 seconds after the user has received the previous results, the list should update "itself" to show that new candidate without requiring any action on the part of the user.
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment28</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment28</guid><pubDate>Sat, 07 Jun 2008 04:13:19 GMT</pubDate></item><item><title>Kevin commented on Request/Reply vs. Pub/Sub</title><description>pub/sub or event-based system is more generic based on  one way message exchange pattern.
  
  
request/reply can be composed with one way message exchange pattern. it's client's behavior to subscribe once and to wait for the response.
  
  
Look at Event Broker in Composite UI (CAB), it's every useful for cross module communication/interaction in a single composite application which is based on event pub/sub.
  
  
inside single module, event bubbling/tunneling,  and request/reply are suitable.
  
  
Cross module/application/system, event based (pub/sub) is more  suitable.
  
  
My speculation:
  
Event Broker for cross module inside an application,
  
NServiceBus for cross application inside a system,
  
ESB for cross systems.
  
  
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment27</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment27</guid><pubDate>Sun, 13 Apr 2008 20:01:49 GMT</pubDate></item><item><title>Bill Poole commented on Request/Reply vs. Pub/Sub</title><description>@ Ayende
  
  
The performance of your publish-subscribe messaging depends on your infrastructure.  Some solutions map a pub-sub topic to a multicast IP address, so this makes the number of subscribers less important.
  
  
Also, you would be surprised what kind of load these messaging systems can handle.  You'd have to be talking some very serious volume before you had a problem.
  
  
I've been using this approach now for a long time and haven't yet come up against any message volume issues.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment26</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment26</guid><pubDate>Sat, 12 Apr 2008 09:52:33 GMT</pubDate></item><item><title>Andreas commented on Request/Reply vs. Pub/Sub</title><description>@ayende
  
  
Regarding network saturation:
  
  
Couldn't you just use [insert your favourite ESB here]: s ability to filter subscriptions based on data?
  
  
In this case: bus.Subscribe("Candidate updates where age &gt; 18") would cause the ESB to filter the events and thereby not saturate the network with events that should be discarded by the clients anyway
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment25</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment25</guid><pubDate>Fri, 11 Apr 2008 19:06:24 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>You can't handle this scenario when you have a lot of listening clients.
  
Just the update events would saturate the network. And most of them would be ignored.
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment24</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment24</guid><pubDate>Fri, 11 Apr 2008 18:02:58 GMT</pubDate></item><item><title>Bill Pierce commented on Request/Reply vs. Pub/Sub</title><description>From my readings into Udi/Bill's work, the system doesn't do any extra work.  
  
  
It always publishes a message when a candidate is modified/updated.  It is your particular client that receives the update message and discards it if the candidate is not over 18 or takes the appropriate action otherwise.  
  
  
That is my limited understanding.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment23</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment23</guid><pubDate>Fri, 11 Apr 2008 15:21:28 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>I disagree, because this requires the system to start maintaining a lot of extra state.
  
Let us say I want candidates over 18. The system now needs to check all new data for this and publish it.
  
If I needed this for a short scan, this is extra work that the system needs to do.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment22</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment22</guid><pubDate>Fri, 11 Apr 2008 13:36:07 GMT</pubDate></item><item><title>David Hanson commented on Request/Reply vs. Pub/Sub</title><description>I would argue that the Request/Response model allows us to achieve a greater level of parallelism  far easier then the publish subscribe model which often depends on a single thread in order to publish messages. 
  
  
That said I do believe there is a place for pub/sub in the UI model.  Look at the fincacial markets and stock trackers for a prime example of a UI that 100% depends on pub/sub. I dont think you could achieve this using request response without exponentionally increasing requests. 
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment21</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment21</guid><pubDate>Fri, 11 Apr 2008 07:38:32 GMT</pubDate></item><item><title>Udi Dahan commented on Request/Reply vs. Pub/Sub</title><description>The difficulty you appear to be having is that you're trying to change the underlying communications style for the same overall design and user interaction.
  
  
For a smart client scenario, consider the following:
  
  
Let's rephrase the requirement that the user wants to see the list of available candidates for a position, but that that list should be updated to show the current status at all times. In other words, if a new candidate joins the system 10 seconds after the user has received the previous results, the list should update "itself" to show that new candidate without requiring any action on the part of the user.
  
  
Now, I'm sure that you'll see the necessity of using pub/sub.
  
  
Not only that, but I think that you'll agree that the overall user experience is much improved.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment20</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment20</guid><pubDate>Fri, 11 Apr 2008 06:24:33 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>I don't care about the message exchange pattern, that is infrastructure for this point of view.
  
What I do care about is how I use it, and what the semantics that the code is exposed to
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment19</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment19</guid><pubDate>Fri, 11 Apr 2008 04:40:39 GMT</pubDate></item><item><title>Evan commented on Request/Reply vs. Pub/Sub</title><description>Looking at your diagram, I'd say you've adopted my position about how the messages will be exchanged.
  
  
We haven't talked about the api via email, so I'm not sure where that came from.
  
  
How is your proposed solution different from what I proposed in email?  The api design is important, but the message exchange pattern is even more important.  How is your proposed message exchange pattern different from what I proposed?
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment18</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment18</guid><pubDate>Fri, 11 Apr 2008 04:24:14 GMT</pubDate></item><item><title>Bill Poole commented on Request/Reply vs. Pub/Sub</title><description>User Interfaces do not really weigh into a discussion on SOA.  UIs sit _behind_ the service boundary.  They are an implementation detail of the service.  So all discussions as to whether we use asynchronous or synchronous messaging or whether we use publish/subscribe or not at the UI is not an SOA discussion.
  
  
There is no issue exposing a CRUD interface for use by a smart client application inside the service boundary.  The exposed interface is a _private_ endpoint, that doesn't appear on the public service contract.  This is described in detail here:
  
  
http://bill-poole.blogspot.com/2008/03/services-and-user-interfaces.html
  
  
As far as asynchronous request-reply vs. publish-subscribe, request-reply makes use of command messages, which introduce coupling between services.  For a full explanation of why we prefer publish-subscribe over command messages in general, read the following blog entries:
  
  
http://bill-poole.blogspot.com/2008/04/avoid-command-messages.html
  
http://bill-poole.blogspot.com/2008/04/soa-and-reuse.html
  
http://bill-poole.blogspot.com/2008/04/when-event-messages-are-not-ideal.html
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment17</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment17</guid><pubDate>Fri, 11 Apr 2008 03:55:56 GMT</pubDate></item><item><title>Chris Patterson commented on Request/Reply vs. Pub/Sub</title><description>For most web applications, I see two models being useful, but the majority would be request/reply.
  
  
If a controller needs data to update the view, most of the time that is a synchronous operation. So the controller can issue a request and wait for the reply (using a correlation id scheme on a common response queue). By using Castle, you can stuff the listener into the container and share it amongst all instances of the controller. 
  
  
You can also make your Request method return an IAsyncResult, having the queue reader set your async wait event when the reply arrives. Standard timeout stuff here works, and you can scale this within ASP.NET since your async waits go outside the regular thread pool.
  
  
For pub/sub, I see this as the async update portion of the system. You setup a long running (comet style) request from the browser to the web server, waiting on anything that happens to arrive. Once something arrives (at the subscriber), you respond to the browser and repost the call to the server. That way, as notifications arrives at the subscription endpoint, the response can be immediately returned to the browser. Good user experience.
  
  
You can also return faults from a remote service by capturing any exceptions, returning a fault message as the reply, and having your application handle the fault message by correlation id. This way, everything is nice and linked up to the original request.
  
  
Just my thoughts, but that's how we've tried to do things in our work-in-progress messaging library MassTransit.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment16</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment16</guid><pubDate>Fri, 11 Apr 2008 00:06:41 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Alex,
  
Getting a response from the infrastructure is problematic. Because most often, the channel you are using will have the send &amp; forget semantics.
  
You can ask for an ACK from the receiving side, but that is strange.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment15</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment15</guid><pubDate>Thu, 10 Apr 2008 22:38:40 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Alex,
  
Yes, that is a major difference between the two. 
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment14</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment14</guid><pubDate>Thu, 10 Apr 2008 22:37:47 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Nathan,
  
Pub/Sub &amp; Req/Resp are both code issues and architectural issues.
  
There seem to be a push to model everything using pub/sub, and I think that for a lot of scenarios, this is the wrong approach.
  
Async call vs. sync call is a different matter, you can do req/resp in async manner, but it is still different than the idea of publishing a message and getting a callback.
  
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment13</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment13</guid><pubDate>Thu, 10 Apr 2008 22:36:14 GMT</pubDate></item><item><title>Alex Simkin commented on Request/Reply vs. Pub/Sub</title><description>@Ayende
  
  
Yes, I don't need response from the service but I need response from infrastructure. It can be an event if we will consider infrastructure as a service, but I wouldn't like it.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment12</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment12</guid><pubDate>Thu, 10 Apr 2008 22:33:58 GMT</pubDate></item><item><title>Alex Simkin commented on Request/Reply vs. Pub/Sub</title><description>As I understand the difference between pub/sub and request/response. In request/responce you know that response will come (maybe in the form of fault). In pub/sub, you have no idea if event you subscribed to will ever fire.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment11</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment11</guid><pubDate>Thu, 10 Apr 2008 22:31:12 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Alex,
  
If this is an option, you wouldn't use request/reply. You would use fire &amp; forget (pub/sub).
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment10</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment10</guid><pubDate>Thu, 10 Apr 2008 22:28:45 GMT</pubDate></item><item><title>Nathan commented on Request/Reply vs. Pub/Sub</title><description>Isn't pub/sub VS request/response an infrastructure issue? Or at least an architectural one. It sounds like your talking about Event Driven Architecture. Isn't the question - should a messaging system consist entirely of pub/sub channels, or is it also appropriate to have request/response channels for certain types of calls? If the discussion is purely about coding style, (wrap the async call with a sync api or use a callback) it probably doesn't make a bit of difference in the end and isn't really about pub/sub or request/response. If it's more than an API /coding style discussion though I simply agree with you, I think, in that for certain types of communication eventing-only will make the overall system rather more complicated that necessary regardless of how you design the endpoint API. I haven't spent too much time studying EDA concepts but if EDA enthusiasts promote only pub/sub channels and nothing but it seems extreme to me, too.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment9</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment9</guid><pubDate>Thu, 10 Apr 2008 22:20:29 GMT</pubDate></item><item><title>Alex Simkin commented on Request/Reply vs. Pub/Sub</title><description>Timeout is a Fault, I can handle it. But my example was a notification that infrastructure is working ok, just didn't deliver message yet.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment8</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment8</guid><pubDate>Thu, 10 Apr 2008 22:19:11 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>No, that is handled by a timeout on the reply, which you should somehow handle.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment7</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment7</guid><pubDate>Thu, 10 Apr 2008 22:15:53 GMT</pubDate></item><item><title>Alex Simkin commented on Request/Reply vs. Pub/Sub</title><description>"...with a reply maybe arrived through a one way input channel. We don't really care about that."
  
  
Sometimes we do care about reply from the infrastructure. If you use MS Exchange, you should be familiar with the message "This message has not yet been delivered. Microsoft Exchange will continue to try delivering the message on your behalf." normally coming when you aready got a call from your party complaining that you din't send what you promised.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment6</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment6</guid><pubDate>Thu, 10 Apr 2008 22:13:04 GMT</pubDate></item><item><title>Evan commented on Request/Reply vs. Pub/Sub</title><description>Let me be clear in saying that I'm not pushing for pub/sub all the way--just avoiding request/response for every scenario possible.  I'll get a response written after my UG meeting tonight.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment5</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment5</guid><pubDate>Thu, 10 Apr 2008 21:56:45 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>Request/reply are not necessarily synchronous.
  
I am not talking about the infrastructure, I am talking about the interface that you use
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment4</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment4</guid><pubDate>Thu, 10 Apr 2008 21:49:49 GMT</pubDate></item><item><title>Nathan commented on Request/Reply vs. Pub/Sub</title><description>Is there a big push for pub/sub ONLY message exchange patterns to be used in a system? To me that seems pretty unnatural as well, even a little crazy - if you want to make a simple request of one and only one service (even if your MOM chooses the specific service using some kind of routing) and the response doesn't represent some business event that is potentially interesting to the system at large but just some set of data you need at the moment I can't see how pub/sub would add any benefit and would only add noise and network traffic. However I also don't see any reason to block your thread or avoid a callback. You're probably going to make your remote call on a thread other than the UI anyway so as to leave the UI responsive if it takes some time to complete so instead of spawning a background thread that blocks while waiting for a synchronous remote call to return, only to ultimately use a callback to update the UI anyway, why not use the bus as your background thread and then you can keep using a single queue based transport for everything, instead of one kind of transport that natively supports synchronous request/response for req/resp calls and a queue based transport for other types of calls. 
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment3</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment3</guid><pubDate>Thu, 10 Apr 2008 21:43:53 GMT</pubDate></item><item><title>Ayende Rahien commented on Request/Reply vs. Pub/Sub</title><description>I think you missed the point, because I am not saying that pub/sub is not useful in UI scenarios.
  
I am saying that in almost any "get data" scenario (and getting updates to data is a different thing), you want request/reply.
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment2</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment2</guid><pubDate>Thu, 10 Apr 2008 21:43:28 GMT</pubDate></item><item><title>Keith Elder commented on Request/Reply vs. Pub/Sub</title><description>Ayende, the thing that first comes to mind is the cost of a request / reply model in a lot of scenarios.
  
  
In your example of the request / reply sure that code is simplier, but it comes at a huge overhead if it has to be run over and over.  Let's say you had a system that was suppose to "alert" end users when they had a new order with a ghost window similar to Outlook when new mail arrives.
  
  
If you use a request / reply model you are going to have to create a timer or something to run that same code over and over.  Not only can that create more load on the system in general but it will create more network traffic for the request to be sent and the reply to come back.  
  
  
In a true sub/pub model, there is a lot less overhead.  One would setup a listener to "listen" for a particular event to happen.  Only when that event did happen would data traverse over the wire.  This is a lot less overhead all the way around. 
  
  
The request / reply model fails completely when it has to be used in a polling situation whereby a client has to ask repeatedly, any data yet?  Any data yet?  Any data yet?  The flip side of pub/sub is "tell me when you have something I care about, otherwise, leave me alone.".
  
  
Maybe I missed your point completely but that's what comes to mind.  
  
</description><link>http://ayende.com/3265/request-reply-vs-pub-sub#comment1</link><guid>http://ayende.com/3265/request-reply-vs-pub-sub#comment1</guid><pubDate>Thu, 10 Apr 2008 21:40:28 GMT</pubDate></item></channel></rss>