File tree Expand file tree Collapse file tree 4 files changed +59
-3
lines changed
Transports/SignalR/Wolverine.SignalR.Tests/Internals Expand file tree Collapse file tree 4 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 1+ using Shouldly ;
2+ using Wolverine . Configuration ;
3+ using Wolverine . SignalR . Internals ;
4+
5+ namespace Wolverine . SignalR . Tests . Internals ;
6+
7+ public class SignalRTransportModeTests
8+ {
9+ private readonly SignalRTransport _transport = new ( ) ;
10+
11+ [ Fact ]
12+ public void does_not_support_durable_mode ( )
13+ {
14+ _transport . SupportsMode ( EndpointMode . Durable ) . ShouldBeFalse ( ) ;
15+ }
16+
17+ [ Fact ]
18+ public void supports_inline_mode ( )
19+ {
20+ _transport . SupportsMode ( EndpointMode . Inline ) . ShouldBeTrue ( ) ;
21+ }
22+
23+ [ Fact ]
24+ public void supports_buffered_in_memory_mode ( )
25+ {
26+ _transport . SupportsMode ( EndpointMode . BufferedInMemory ) . ShouldBeTrue ( ) ;
27+ }
28+
29+ [ Fact ]
30+ public void setting_durable_mode_throws_exception ( )
31+ {
32+ Should . Throw < InvalidOperationException > ( ( ) => _transport . Mode = EndpointMode . Durable ) ;
33+ }
34+ }
Original file line number Diff line number Diff line change @@ -442,7 +442,15 @@ protected virtual bool supportsMode(EndpointMode mode)
442442 {
443443 return true ;
444444 }
445-
445+
446+ /// <summary>
447+ /// Check if this endpoint supports the specified mode
448+ /// </summary>
449+ public bool SupportsMode ( EndpointMode mode )
450+ {
451+ return supportsMode ( mode ) ;
452+ }
453+
446454 // Is this endpoint part of a sharded messaging topology?
447455 // If so, this should be "auto-started"
448456 internal bool UsedInShardedTopology { get ; set ; }
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ public interface ISubscriberConfiguration<T> : IEndpointConfiguration<T> where T
7070 /// </summary>
7171 /// <returns></returns>
7272 public T GlobalSender ( ) ;
73+
74+ public Endpoint Endpoint { get ; }
7375}
7476
7577public interface ISubscriberConfiguration : ISubscriberConfiguration < ISubscriberConfiguration > ;
Original file line number Diff line number Diff line change @@ -72,7 +72,13 @@ void IPolicies.Add(IWolverinePolicy policy)
7272
7373 void IPolicies . UseDurableInboxOnAllListeners ( )
7474 {
75- this . As < IPolicies > ( ) . AllListeners ( x => x . UseDurableInbox ( ) ) ;
75+ this . As < IPolicies > ( ) . AllListeners ( x =>
76+ {
77+ if ( x . Endpoint . SupportsMode ( EndpointMode . Durable ) )
78+ {
79+ x . UseDurableInbox ( ) ;
80+ }
81+ } ) ;
7682 }
7783
7884 internal readonly List < IHandledTypeRule > HandledTypeRules = [ new AgentCommandHandledTypeRule ( ) ] ;
@@ -94,7 +100,13 @@ void IPolicies.UseDurableLocalQueues()
94100
95101 void IPolicies . UseDurableOutboxOnAllSendingEndpoints ( )
96102 {
97- this . As < IPolicies > ( ) . AllSenders ( x => x . UseDurableOutbox ( ) ) ;
103+ this . As < IPolicies > ( ) . AllSenders ( x =>
104+ {
105+ if ( x . Endpoint . SupportsMode ( EndpointMode . Durable ) )
106+ {
107+ x . UseDurableOutbox ( ) ;
108+ }
109+ } ) ;
98110 }
99111
100112 void IPolicies . AllListeners ( Action < ListenerConfiguration > configure )
You can’t perform that action at this time.
0 commit comments