I've been digging into MT and have some questions about service
design. It seems that the fundamental approach of MT is client-
centric.
Meaning, the conversation goes:
1) "I'm a client listening for requests at this Queue, let me tell my
subscription manager about me"
2) "I'm a subscription manager- who are my clients and where are their
endpoints."
3) "I'm a publisher/server- I send messages but don't know/care who's
listening. If my subscription manager tells me about a client, I'll
send them a message"
The problem I have with this is I don't want to deal with a
subscription manager (side note- am I wrong for not wanting this? I'm
not really interested in directly linking pub/subs together- I want
distributed worker processing via competing consumer).
I just want n
number of systems to publish messages to a common queue, and have x
number of consumers processing those messages.
A publisher should
always send a message to a queue, and trust that something, at some
other point in time, will pick up the message and deal with it.
I don't feel I can easily do this with Mass Transit- but am I missing
something? My intention was to create a DummySubscriptionManager that
always publishes messages to a specified queue,
but then I realized
the design of the bus was to Listen with queues (endpointToListenOn),
not publish to them directly. I know that DeadLetterQueueing is in
the works,
but that's also not really an approach I want to take-
again, I don't care about multiple subscribers with single publishers-
I want more of an "event based" distributed system.
My other idea was to have my publisher directly send messages via an
endpoint, not the bus. Then use the bus/sagas/etc. to process
messages. Thoughts?
Thanks,
Mike
Thanks for all the responses- I keep enjoying MT the more I dig into
it. I have to say, the infrastructure is pretty slick!
I was able to get started with .EndPointFactory/Send() approach on one
side with the Consumes class on the other. At this point, I'm still
trying to understand the problems with distributed programming which
MT solves. I wasn't sure if just using the EndPointFactory/Send() was
the "right" way to do it.
I can see how using a subscription service
will make the entire app a lot easier to manage (by consolidating
configuration/monitoring heartbeats/subscription management).
Looking at the samples, it seemed you always needed a consumer to
publish via the bus. This is what I meant by coupling- I wouldn't
want a producer to not send a message if no one was listening.
Producers should always publish messages into a queue
(and if it
didn't know which queue, then maybe a dead letter queue).
The
behavior of a publisher always sending a message is exactly what I got
with the EndpointFactory/Send(),
and what I couldn't figure out how to
do with a subscription service.
But I'll look into how
PersistentSubscriptions can solve that problem.
I was also confused on how the subscription service worked- I was
worried that the bus sent a copy of each published message to all
subscribers.
Which it does- I was just confusing subscribers with
instances. The copy goes to each type of subscription, not each
running instance (for "competing consumers").