Пример #1
0
        public async Task <IActionResult> ProcessTenantTopic([FromBody] TopicData <Tenant> tenantTopicData)
        {
            if (!string.IsNullOrWhiteSpace(tenantTopicData.Data.Id))
            {
                _logger.LogInformation($"Receive tenant topic type {tenantTopicData.TopicType} id: {tenantTopicData.Data.Id}");
                string cacheKey = $"{CacheConstant.Tenant_}{tenantTopicData.Data.Id}";
                switch (tenantTopicData.TopicType)
                {
                case TopicType.Remove:
                    await _tenantCacheService.ClearCacheAsync(_daprClient, cacheKey);

                    break;

                case TopicType.Modify:
                    await _tenantCacheService.UpdateCacheAsync(_daprClient, cacheKey, tenantTopicData.Data);

                    break;
                }
            }
            else
            {
                _logger.LogWarning($"Receive tenant topic without id");
            }
            return(Ok());
        }