[SPIKE] Spike raw dispatch pipeline#4847
Conversation
| class SomeStartupTaskWhichDoesRawSends : FeatureStartupTask { | ||
| protected override Task OnStart(IMessageSession session) | ||
| { | ||
| var rawSession = session.Raw(); |
There was a problem hiding this comment.
In theory the extension method could also be scoped to FeatureStartupTask only like the following:
static IMessageSessionRaw Raw(this FeatureStartupTask task, IMessageSession session);
usage
var rawSession = this.Raw(session);
rawSession.Dispatch()
so that it can't be abused on endpoint level for example. But on the other-hand why not allow it?
|
I really really like it. Calling the dispatcher directly was one of the most painful things I experience when trying to extend V6. |
|
looks like a promising approach to me. I'm not yet entirely convinced how we would expose the "raw" API, as it seems like this shouldn't be on the same level as pipeline-based operations (at least not inside message handlers). Might be good enough to put the extension methods into a dedicated namespace though. |
|
@danielmarbach can I also have a switch for disabling the main pipeline? ;-) Then I would be able to drop support for NSB.Raw |
|
So do I get the blessing to do this for real from @Particular/nservicebus-maintainers ? |
|
@danielmarbach listed it as a topic for the next weekly sync. |
|
we discussed this on the weekly sync and we agreed that the listed changes are definitely desirable improvements as long as we prevent this API being available on the messagehandlercontext. There are certainly a few things to discuss further, e.g. naming, but in general we think this is worth doing 👍 Ideas around the NSB.Raw functionality are something we definitely see as something outside the scope of this PR. |
|
Cool. Let me know how we should proceed with this. |
|
@Particular/nservicebus-maintainers so can I go ahead with this? Since this enables us to remove hacky code in ASQ acceptance tests where we need to wrap the serializer and add a pipeline step in order to be able to stamp all outgoing messages |
|
@danielmarbach will this involve breaking changes or can this be shipped in a minor version? |
|
@andreasohlund I tried to do it without breaking changes. Still I implemented IExtendable on error context and switch pipelineterminators to stages. Not sure about the implications of that. |
|
that shouldn't be a blocker for a minor then?
as 7.1 would be the earliest version to bring that in, feel free to decide when to start polishing this in order to avoid too much effort in keeping your branch up-to-date. Maybe hold back till RC phase? |
|
Had a good discussion with @andreasohlund today and we reiterated on the original decision decisions around message driven pubsub, timeouts, recoverability, and satellites. We concluded the following:
From ASQ perspective there is a workaround. We can register a hook in the settings of type Func<IDispatchMessages, IDispatchMessages> which allows ATTs to decorate the dispatch calls and stamp each and every message. Closing this. |
|
Where is the handling of |
|
@SzymonPobiega we have to hack it into the transport for now as a "magic hidden settings key" |
|
@SzymonPobiega are you saying you'd have like the |
|
@danielmarbach well, when in FST you usually need to send raw messages, not regular ones. In the current version you need to pass in a dispatcher as the session you get is pretty much useless. That's an inconvenience bu not a huge problem. |
| /// <param name="context"></param> | ||
| /// <param name="operations"></param> | ||
| /// <returns></returns> | ||
| public static Task Dispatch(this MessageContext context, params TransportOperation[] operations) |
There was a problem hiding this comment.
Yes! This would be so awesome for some scenarios!
Attention: Does not even compile. I didn't want to spend too much time on this
While brainstorming how we could get rid of the builder calls I looked how we could get rid of the builder calls for the dispatcher. This is an attempt to do so.
For me beside reducing the builder calls the fact that it allows properly extend the raw dispatches is a huge plus.