public async Task CreateComponentTokenToThisNode(CreateComponentTokenDetails createComponentTokenDetails)
        {
            if (_tenantRepository.GetComponentToken(createComponentTokenDetails.Tenant, createComponentTokenDetails.Product, createComponentTokenDetails.Component, createComponentTokenDetails.Token.Token) == null)
            {
                _componentApiService.AddComponentToken(createComponentTokenDetails.Tenant, createComponentTokenDetails.Product, createComponentTokenDetails.Component, createComponentTokenDetails.Token, false);
            }

            // send to other nodes....
            await _storageHubService.SendCreateComponentTokenStorage(createComponentTokenDetails);
        }
        public async Task SendCreateComponentTokenStorage(CreateComponentTokenDetails createComponentTokenDetails)
        {
            foreach (var storage in _storageHubRepository.GetStorages())
            {
                if (createComponentTokenDetails.StoragesAlreadySent.Contains(storage.Key) != true)
                {
                    createComponentTokenDetails.StoragesAlreadySent.Add(storage.Key);
                    // send to this storage
                    await _hub.Clients.Client(storage.Value.Agents.First().Key).ComponentTokenCreated(new Model.Storages.Events.Components.ComponentTokenCreatedDetails()
                    {
                        Tenant    = createComponentTokenDetails.Tenant,
                        Product   = createComponentTokenDetails.Product,
                        Component = createComponentTokenDetails.Component,
                        Token     = createComponentTokenDetails.Token,

                        StoragesAlreadySent = createComponentTokenDetails.StoragesAlreadySent,
                    });
                }
            }
        }
Beispiel #3
0
 public async Task CreateComponentToken(CreateComponentTokenDetails createComponentTokenDetails)
 {
     await consumerHubService.CreateComponentTokenToThisNode(createComponentTokenDetails);
 }