MT3 filter example?

90 views
Skip to first unread message

Kevin Sigmund

unread,
Jul 2, 2015, 1:32:57 AM7/2/15
to masstrans...@googlegroups.com
I'm having trouble with the MT3 filtering syntax.  I'm looking for a simple example to filter the events that a consumer consumes, based on some property type.


It seems like I need something like:  e.Consumer<MyNotificationConsumer>().Filter(...what goes here?...);

Am I off base on how the Filter functionality works?  If not, I think I just need some clarification on the syntax.

Chris Patterson

unread,
Jul 2, 2015, 2:05:42 PM7/2/15
to masstrans...@googlegroups.com
What are you expecting to happen if a message is being delivered to a consumer, and your filter prior to the consumer determines that the message should not be delivered to the consumer?

Should it be moved to the error queue?
Should it be discarded (removed from the queue, but not handled by the consumer)?
Should it be moved to some other queue?

With an understanding of the behavior your are trying to achieve, a better answer can be provided.


--
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/65035741-e0ea-4295-b881-294c5e01d0d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin S. Sigmund

unread,
Jul 2, 2015, 2:11:05 PM7/2/15
to masstrans...@googlegroups.com
Great questions.  My intention is to have multiple consumers subscribed, each of which would handle a different subset of messages, based on some set of criteria (just one criterion at the moment, which is basically a "type" property).

I haven't used MT2, but since there's currently more documentation on that ;-) I'm trying to approximate the functionality of the .All, etc. syntax, though I may be misunderstanding it.

So to answer your questions, I'd expect the message to be placed back on the queue or not consumed at all if it's picked up by a consumer that can't "handle" it based on the filter.

Is the real solution here to have multiple queues for each "type" (i.e. subset) of these messages?

--
You received this message because you are subscribed to a topic in the Google Groups "masstransit-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/masstransit-discuss/Hz2h3c4nrM0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Jul 2, 2015, 2:14:10 PM7/2/15
to masstrans...@googlegroups.com
Yes, the real solution is to separate the concerns into different messages types, or different queues for those message types. Otherwise, you end up with multiple consumers fighting over the same pool of messages and you can stall message consumption if nobody is interested in the front of the queue.

It's also why the .Selected option was removed in MT3, because it was a bad idea when I created it some 7 years ago.


Michael D

unread,
Jul 15, 2015, 5:06:05 PM7/15/15
to masstrans...@googlegroups.com
Hello,

I have different use case where I think filtering should be useful.

As a sample lets take a chat room application where messages can be broadcasted to all users or a private message can be sent to specific user.
The client should be able to subscribe to MessageEvent where Recepient property either null (all users) or equal to current user's ID.

What is the recommended approach? 

Thanks 
Reply all
Reply to author
Forward
0 new messages