New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always process messages that have handlers regardless of conventions #5342
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f17a0fe
Remove early exit in handler registry
andreasohlund 05eda2b
Update When_receiving_non_matching_message_with_handler.cs
andreasohlund f427c1a
Remove unused member
andreasohlund 12e58a2
Remove convention check from get all
andreasohlund f4ca1d3
Approvals for the default ctor
andreasohlund File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...eBus.AcceptanceTests/Core/Conventions/When_receiving_non_matching_message_with_handler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
namespace NServiceBus.AcceptanceTests.Core.Conventions | ||
{ | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using AcceptanceTesting.Customization; | ||
using EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_receiving_non_matching_message_with_handler : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_process_message() | ||
{ | ||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Sender>(c => c.When(s => s.Send(new NonMatchingMessageWithHandler()))) | ||
.WithEndpoint<Receiver>() | ||
.Done(c => c.GotTheMessage) | ||
.Run(); | ||
|
||
Assert.True(context.GotTheMessage); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool GotTheMessage { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>(c => | ||
{ | ||
c.ConfigureTransport().Routing().RouteToEndpoint(typeof(NonMatchingMessageWithHandler), typeof(Receiver)); | ||
}); | ||
} | ||
} | ||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(c => c.Conventions().DefiningMessagesAs(t => false)); | ||
} | ||
|
||
class MyHandler : IHandleMessages<NonMatchingMessageWithHandler> | ||
{ | ||
public Context TestContext { get; set; } | ||
|
||
public Task Handle(NonMatchingMessageWithHandler message, IMessageHandlerContext context) | ||
{ | ||
TestContext.GotTheMessage = true; | ||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public class NonMatchingMessageWithHandler : IMessage | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to keep an internal constructor around to prevent the default public constructor from being added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we made the ctor internal back in the day. Do we see any drawback in exposing the public ctor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't suppose there is any problem with allowing this. You'll need to update the API approval test, then.