public override void AnnounceServer(string serverId, ServerContext context) { if (serverId == null) { throw new ArgumentNullException(nameof(serverId)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } Documents.Server server = new Documents.Server { ServerId = serverId, Workers = context.WorkerCount, Queues = context.Queues, CreatedOn = DateTime.UtcNow, LastHeartbeat = DateTime.UtcNow }; Uri spAnnounceServerUri = UriFactory.CreateStoredProcedureUri(Storage.Options.DatabaseName, Storage.Options.CollectionName, "announceServer"); Task <StoredProcedureResponse <bool> > task = Storage.Client.ExecuteStoredProcedureAsync <bool>(spAnnounceServerUri, server); task.Wait(); }
public override void AnnounceServer(string serverId, ServerContext context) { if (serverId == null) { throw new ArgumentNullException(nameof(serverId)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } Documents.Server server = new Documents.Server { Id = $"{serverId}:{DocumentTypes.Server}".GenerateHash(), ServerId = serverId, Workers = context.WorkerCount, Queues = context.Queues, CreatedOn = DateTime.UtcNow, LastHeartbeat = DateTime.UtcNow }; Task <ItemResponse <Documents.Server> > task = Storage.Container.UpsertItemWithRetriesAsync(server, new PartitionKey((int)DocumentTypes.Server)); task.Wait(); }
public override void AnnounceServer(string serverId, ServerContext context) { if (serverId == null) { throw new ArgumentNullException(nameof(serverId)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } Documents.Server server = new Documents.Server { Id = $"{serverId}:{DocumentTypes.Server}".GenerateHash(), ServerId = serverId, Workers = context.WorkerCount, Queues = context.Queues, CreatedOn = DateTime.UtcNow, LastHeartbeat = DateTime.UtcNow }; Task <ResourceResponse <Document> > task = Storage.Client.UpsertDocumentWithRetriesAsync(Storage.CollectionUri, server); task.Wait(); }