@@ -21,6 +21,7 @@ namespace Halibut
2121{
2222 public class HalibutRuntime : IHalibutRuntime
2323 {
24+ public const string QueueEndpointScheme = "local" ;
2425 public static readonly string DefaultFriendlyHtmlPageContent = "<html><body><p>Hello!</p></body></html>" ;
2526 readonly ConcurrentDictionary < Uri , IPendingRequestQueue > queues = new ( ) ;
2627 readonly IPendingRequestQueueFactory queueFactory ;
@@ -199,17 +200,17 @@ public void Poll(Uri subscription, ServiceEndPoint endPoint, CancellationToken c
199200 pollingClients . Add ( new PollingClient ( subscription , client , HandleIncomingRequestAsync , log , cancellationToken , pollingReconnectRetryPolicy ) ) ;
200201 }
201202
202- public async Task PollLocalAsync ( Uri localEndpoint , CancellationToken cancellationToken )
203+ public async Task PollForRPCOverQueueAsync ( Uri queueOnlyEndpoint , CancellationToken cancellationToken )
203204 {
204- if ( localEndpoint . Scheme . ToLowerInvariant ( ) != "local" )
205+ if ( queueOnlyEndpoint . Scheme . ToLowerInvariant ( ) != QueueEndpointScheme )
205206 {
206- throw new ArgumentException ( $ "Only 'local ://' endpoints are supported. Provided: { localEndpoint . Scheme } ://", nameof ( localEndpoint ) ) ;
207+ throw new ArgumentException ( $ "Only 'queue ://' endpoints are supported. Provided: { queueOnlyEndpoint . Scheme } ://", nameof ( queueOnlyEndpoint ) ) ;
207208 }
208209
209- var queue = GetQueue ( localEndpoint ) ;
210- var log = logs . ForEndpoint ( localEndpoint ) ;
210+ var queue = GetQueue ( queueOnlyEndpoint ) ;
211+ var log = logs . ForEndpoint ( queueOnlyEndpoint ) ;
211212
212- log . Write ( EventType . MessageExchange , $ "Starting local polling for endpoint: { localEndpoint } ") ;
213+ log . Write ( EventType . MessageExchange , $ "Starting queue polling for endpoint: { queueOnlyEndpoint } ") ;
213214
214215 while ( ! cancellationToken . IsCancellationRequested )
215216 {
@@ -226,7 +227,7 @@ public async Task PollLocalAsync(Uri localEndpoint, CancellationToken cancellati
226227 }
227228 catch ( Exception ex )
228229 {
229- log . WriteException ( EventType . Error , $ "Error executing local request for { request . RequestMessage . ServiceName } .{ request . RequestMessage . MethodName } ", ex ) ;
230+ log . WriteException ( EventType . Error , $ "Error executing queue request for { request . RequestMessage . ServiceName } .{ request . RequestMessage . MethodName } ", ex ) ;
230231 response = ResponseMessage . FromException ( request . RequestMessage , ex ) ;
231232 }
232233
@@ -235,17 +236,17 @@ public async Task PollLocalAsync(Uri localEndpoint, CancellationToken cancellati
235236 }
236237 catch ( OperationCanceledException ) when ( cancellationToken . IsCancellationRequested )
237238 {
238- log . Write ( EventType . MessageExchange , $ "Local polling cancelled for endpoint: { localEndpoint } ") ;
239+ log . Write ( EventType . MessageExchange , $ "Queue polling cancelled for endpoint: { queueOnlyEndpoint } ") ;
239240 break ;
240241 }
241242 catch ( Exception ex )
242243 {
243- log . WriteException ( EventType . Error , $ "Error in local polling loop for endpoint: { localEndpoint } ", ex ) ;
244+ log . WriteException ( EventType . Error , $ "Error in queue polling loop for endpoint: { queueOnlyEndpoint } ", ex ) ;
244245 await Task . Delay ( TimeSpan . FromSeconds ( 1 ) , cancellationToken ) ;
245246 }
246247 }
247248
248- log . Write ( EventType . MessageExchange , $ "Local polling stopped for endpoint: { localEndpoint } ") ;
249+ log . Write ( EventType . MessageExchange , $ "Queue polling stopped for endpoint: { queueOnlyEndpoint } ") ;
249250 }
250251
251252 public async Task < ServiceEndPoint > DiscoverAsync ( Uri uri , CancellationToken cancellationToken )
@@ -291,9 +292,7 @@ async Task<ResponseMessage> SendOutgoingRequestAsync(RequestMessage request, Met
291292 response = await SendOutgoingHttpsRequestAsync ( request , cancellationToken ) . ConfigureAwait ( false ) ;
292293 break ;
293294 case "poll" :
294- response = await SendOutgoingPollingRequestAsync ( request , cancellationToken ) . ConfigureAwait ( false ) ;
295- break ;
296- case "local" :
295+ case QueueEndpointScheme :
297296 response = await SendOutgoingPollingRequestAsync ( request , cancellationToken ) . ConfigureAwait ( false ) ;
298297 break ;
299298 default : throw new ArgumentException ( "Unknown endpoint type: " + endPoint . BaseUri . Scheme ) ;
0 commit comments