Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion specs/ClientInvocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ Basically the process is similar and the major different is that service underst

### Transient Mode(TODO)

## Limitations

> NOTES
>
> * Service cached pending invocations for at most __10 minutes__ for memory concerns and will notify server when timeout.
> * Serverless is __NOT__ supporeted in the first stage.
> * ASPNET SignalR is __NOT__ supported.
> * Sharding is __NOT__ supported. Please use [Geo-Replication](https://learn.microsoft.com/azure/azure-signalr/howto-enable-geo-replication) for combined client invocation and large scale scenarios.
> * Sharding is __NOT__ fully supported yet. Please use [Geo-Replication](https://learn.microsoft.com/azure/azure-signalr/howto-enable-geo-replication) for combined client invocation and large scale scenarios. Also see [this](https://github.com/Azure/azure-signalr/pull/1828) for planning.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ internal IEnumerable<ServiceEndpoint> GetRoutedEndpoints(ServiceMessage message)
case CloseConnectionMessage closeConnectionMessage:
return _router.GetEndpointsForConnection(closeConnectionMessage.ConnectionId, endpoints);

case ClientInvocationMessage clientInvocationMessage:
return SingleOrNotSupported(_router.GetEndpointsForConnection(clientInvocationMessage.ConnectionId, endpoints), clientInvocationMessage);

case ServiceMappingMessage serviceMappingMessage:
return SingleOrNotSupported(_router.GetEndpointsForConnection(serviceMappingMessage.ConnectionId, endpoints), serviceMappingMessage);

case ServiceCompletionMessage serviceCompletionMessage:
return SingleOrNotSupported(_router.GetEndpointsForConnection(serviceCompletionMessage.ConnectionId, endpoints), serviceCompletionMessage);

default:
throw new NotSupportedException(message.GetType().Name);
}
Expand Down Expand Up @@ -416,6 +425,20 @@ private async Task WaitForClientsDisconnect(HubServiceEndpoint endpoint)
Log.TimeoutWaitingClientsDisconnect(_logger, endpoint.ToString(), (int)_scaleTimeout.TotalSeconds);
}

private IEnumerable<ServiceEndpoint> SingleOrNotSupported(IEnumerable<ServiceEndpoint> endpoints, ServiceMessage message)
{
var endpointCnt = endpoints.ToList().Count;
if (endpointCnt == 1)
{
return endpoints;
}
if (endpointCnt == 0)
{
throw new ArgumentException("Client invocation is not sent because no endpoint is returned from the endpoint router.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw AzureSignalRNoEndpointAvailableException?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception sounds like endpoints are down but actually results are returned from (custom) router. So suggest current information is clear enough.

}
throw new NotSupportedException("Client invocation to wait for multiple endpoints' results is not supported yet.");
}

internal static class Log
{
private static readonly Action<ILogger, string, Exception> _startingConnection =
Expand Down