Dynamic registration of consumers and a redirecting consumer

492 views
Skip to first unread message

Bryan Crosby

unread,
Jun 11, 2016, 8:19:05 PM6/11/16
to masstransit-discuss
I'm interested in trying out MassTransit. I do understand that at some levels, coupling to MT is necessary. However, is it possible to use my own implementation of a handler instead of IConsumer<T>? Is there a hook in the library to "automagically" discover IConsumer instances instead of explicitly registering them at compile time.

I'd like to describe in detail a bit more what I am trying to accomplish.

I would like my own implementation of IHandler<T> to execute, instead of an IConsumer<T>. I would like a consumer to marshal my own custom consume context back up to my handler. For example, consider my own handler of SendEmailToCustomerHandler that implements IHandler<SendEmailEvent>. I'd ideally want MassTransit to have it's IConsumer<SendEmailEvent>, but instead of having the Consume method called, I'd like to marshal this to my own event handler.

The end goal would be to not have to use IConsumer<T> when using my event handlers in my project directly, but rather provide a thin veneer on top of it.

Chris Patterson

unread,
Jun 11, 2016, 10:17:47 PM6/11/16
to masstrans...@googlegroups.com
Take a look at this test folder to see how this can be done. This was written for a guy who wanted the same thing but ended up realizing it was more work than desired. 


Essentially creating your own registration convention. 

__
Chris Patterson




--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/1187d0ff-abd6-4b99-b824-9835aca65e63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages