-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug in handling callbacks via main queue.
- Loading branch information
1 parent
781c1eb
commit f987ce4
Showing
4 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
src/NServiceBus.SqlServer.AcceptanceTests/When_callback_receiver_is_disabled.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,63 @@ | ||
namespace NServiceBus.SqlServer.AcceptanceTests | ||
{ | ||
using NServiceBus.AcceptanceTesting; | ||
using NServiceBus.AcceptanceTests.EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_callback_receiver_is_disabled | ||
{ | ||
[Test] | ||
public void Should_still_receive_callbacks() | ||
{ | ||
var context = new Context(); | ||
|
||
Scenario.Define(context) | ||
.WithEndpoint<ServerThatRespondsToCallbacks>() | ||
.WithEndpoint<ScaledOutClient>(b => b.Given((bus, c) => bus.Send(new MyRequest()) | ||
.Register(m => | ||
{ | ||
c.GotTheCallback = true; | ||
}))) | ||
.Done(c => context.GotTheCallback) | ||
.Run(); | ||
|
||
Assert.True(context.GotTheCallback, "Should get the callback"); | ||
} | ||
|
||
public class ScaledOutClient : EndpointConfigurationBuilder | ||
{ | ||
public ScaledOutClient() | ||
{ | ||
EndpointSetup<DefaultServer>(c => c.UseTransport<SqlServerTransport>().DisableCallbackReceiver()) | ||
.AddMapping<MyRequest>(typeof(ServerThatRespondsToCallbacks)); | ||
} | ||
} | ||
|
||
public class ServerThatRespondsToCallbacks : EndpointConfigurationBuilder | ||
{ | ||
public ServerThatRespondsToCallbacks() | ||
{ | ||
EndpointSetup<DefaultServer>(); | ||
} | ||
|
||
class MyEventHandler : IHandleMessages<MyRequest> | ||
{ | ||
public IBus Bus { get; set; } | ||
|
||
public void Handle(MyRequest message) | ||
{ | ||
Bus.Return(1); | ||
} | ||
} | ||
} | ||
|
||
class MyRequest : IMessage | ||
{ | ||
} | ||
|
||
class Context : ScenarioContext | ||
{ | ||
public bool GotTheCallback { get; set; } | ||
} | ||
} | ||
} |
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