Ejemplo n.º 1
0
        public async Task <OccupyInstanceResult> ExecuteAsync(OccupyInstance command, CancellationToken cancellationToken)
        {
            Uri serviceUri = await repository.GetServiceUriAsync(cancellationToken);

            await instanceProxy.OccupyAsync(serviceUri, command.InstanceId, command.InstanceName);

            await Task.WhenAll(
                repository.SetServiceInstanceName(command.InstanceName, cancellationToken),
                repository.SetPartitionIdAsync(command.PartitionId, cancellationToken),
                repository.SetServiceLastActiveAsync(DateTime.UtcNow, cancellationToken)
                );

            return(new OccupyInstanceResult(serviceUri));
        }