Ejemplo n.º 1
0
        public async Task <OccupyInstanceResult> OccupyAsync(OccupyInstance command, CancellationToken cancellationToken)
        {
            _currentState = await _currentState.OccupyAsync(this, command, cancellationToken);

            await repository.SetInstanceStateAsync(_currentState.State, cancellationToken);

            var serviceName = await repository.GetServiceUriAsync(cancellationToken);

            return(new OccupyInstanceResult(serviceName));
        }
Ejemplo n.º 2
0
        public override async Task <InstanceState> OccupyAsync(InstanceContext context, OccupyInstance command, CancellationToken cancellationToken)
        {
            await context.Mediator.ExecuteAsync(command, cancellationToken);

            return(context.InstanceStates.Get(InstanceStates.Occupied));
        }
Ejemplo n.º 3
0
 public override Task <InstanceState> OccupyAsync(InstanceContext context, OccupyInstance command, CancellationToken cancellationToken) =>
 Task.FromResult <InstanceState>(this);
Ejemplo n.º 4
0
 public override Task <InstanceState> OccupyAsync(InstanceContext context, OccupyInstance command, CancellationToken cancellationToken) =>
 throw new Exception("Invalid state transition. Cannot occupy an idle service.");
 public abstract Task <InstanceState> OccupyAsync(InstanceContext context, OccupyInstance command, CancellationToken cancellationToken);