If you are interested in looking at a CQRS example written in C# then
you
may want to look at mine:
https://github.com/MarkNijhof/Fohjin/tree/master/Fohjin.DDD.Example
I'd be happy to answer questions on it as well and I wrote several
posts
about the example as well which are linked from the readme. It is
however my
last bit of public C# code and about a year and a half old, so a bit
fuzzy
:P
Cheers,
-Mark
On Aug 3, 9:29 am, Alastair Smith <
alast...@alastairsmith.me.uk>
wrote:
> I had the same reaction, really - I just don't know enough about messaging.
>
> I can say, however, that I've been playing around with the Reactive
> Extensions for a couple of weeks now, and although there's a large learning
> curve, they're pretty sweet to use: LINQ to Events is a pretty powerful
> concept. Unfortunately the steep learning curve is hampered by the fact
> that the XML documentation on the library is non-existent, and it's changing
> so often that many of the web examples are out of date. However, there are
> some really great videos <
http://channel9.msdn.com/Tags/rx/> on Channel 9
> that are more up-to-date.
>
> Ian Cooper is your man on CQRS if you want to investigate that (he and Greg
> Young have blogged about it
> extensively<
http://codebetter.com/globalsearch/?cx=005178204031477491434%3A2bg5jt...>on
> CodeBetter.com, andhttp://
cqrsinfo.com/is a good resource too). Bobby's right that Udi Dahan
> is big on messaging in .NET.
>
> Alastair
>
> --
> Alastair Smith MEng DipABRSMhttp://
www.alastairsmith.me.uk/
>
> On 3 August 2011 04:47, ROBERT JOHNSON <
bobby.john...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi Charles,
>
> > I have been looking at this message for two days now and desperately want
> > to reply to encourage my fellow .NET developers to participate in SC. But
> > sadly, I am just not that experienced in messaging models. I have heard many
> > good things about the EventAggregator pattern, CQRS and Reactive extensions
> > in the .NET space. Have you had any exposure to them? Messaging in .NET
> > seems to be the domain of Udi Dahan currently are you familiar with him?
>
> > Bobby
>
> > On Aug 1, 2011, at 10:09 AM, Charles Strahan wrote:
>
> > Hello all,
>
> > I've found that there exist three common methods of messaging in .NET:
>
> > 1. Use a *MessageBus, which sits between the subscriber and publisher.
> > 2. Creating a .NET event and explicitly subscribing.
> > 3. Directly invoke some method on the "subscriber".
> > - Note that I consider methods just another form of messaging
> > passing, although I don't know if that's a common model.
>
> > **Where "MessageBus" might look like:*
> > *
> > *
> > public class MessageBus : IMessageBus
> > {
> > private readonly IWindsorContainer container;
>
> > public MessageBus(IWindsorContainer container)
> > {
> > this.container = container;
> > }
>
> > public void Publish<TMessage>(TMessage message) where TMessage :
> > class, IMessage
> > {
> > var eventHandlers = container.ResolveAll<IMessageHandler<
> > TMessage>>();
> > foreach (var eventHandler in eventHandlers)
> > {
> > eventHandler.Handle(message);
> > }
> > }
> > }
>
> > What I'm curious about is how one more skilled than myself decides which
> > option to take. Of course, the choice is pretty obvious in some cases: I
> > know of no one that would make the interface to their Repositories consist
> > of sending commands via a MessageBus - one would directly invoke a method on
> > their Repository reference.
>
> > My thoughts on each:
>
> > 1. Use a MessageBus, which sits between the subscriber and publisher.
> > - Very loosely coupled - publishers never need to know how their
> > message gets to the interested observers.
> > - Convenient for dependency injection.
> > - Anything with a reference to the MessageBus can publish. Good
> > thing... or bad thing?
> > 2. Creating a .NET event and explicitly subscribing.
> > - Subscribers have direct control over who they listen to.
> > - Moderate coupling.
> > 3. Directly invoke some method on the "subscriber" (perhaps subscriber
> > in this case is injected into publisher).
> > - Typically suits a 1:1 relationship between the "subscriber" and
> > "publisher".
> > - Highly coupled - the subscribing instance must match in type.
>
> > If I had to come up with some general rules for deciding among the three:
>
> > 1. Use a MessageBus, which sits between the subscriber and publisher.
> > - Use in the Domain layer, capturing the essence of (and modeling)
> > the natural events of the business. (Perhaps weather updates, stock price
> > fluctuations, whatever)
> > 2. Creating a .NET event and explicitly subscribing.
> > - Use in supporting infrastructure. Theoretically, if you had to
> > roll your own TcpClient you'd want to use an event to model the "connected"
> > event.
> > 3. Directly invoke some method on the "subscriber" (perhaps subscriber
> > in this case is injected into publisher).
> > - Again, use in supporting infrastructure. You could always supply a
> > callback for one-off subscriptions. If you *wouldn't* use *any* sort
> > of callback mechanism for encoding some bytes (unless it's truly an async
> > operation).
>
> > Any thoughts? I'm sure these observations are pretty elementary; however, I
> > haven't seen anyone lay out any rigorous guidance on this aspect of design.
> > Ultimately, one could construct any software out of *exclusively* any one
> > of those patterns, although I doubt anyone would ever think that's a good
> > idea.
>
> > So, how do *you* decide which option to go with?