public async Task Execute(IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository serviceLogRepository, ActionMessage message, IDbTransaction transaction) { var tenantInfo = await applicationSettingsRepository.GetTenantInfo(transaction); var tenantId = tenantInfo?.TenantId; try { if (string.IsNullOrWhiteSpace(tenantId)) { throw new TenantInfoNotFoundException("No tenant information found. Please contact your administrator."); } await WorkflowMessagingProcessor.Instance.SendMessageAsync(tenantId, message); await serviceLogRepository.LogInformation("SendMessageExecutor", $"Sent {message.ActionType} message for tenant {tenantId}: {message.ToJSON()}"); } catch (Exception ex) { await serviceLogRepository.LogError("SendMessageExecutor", $"Failed to send {message.ActionType} message for tenant {tenantId}: {message.ToJSON()}. Exception: {ex.Message}"); throw; } }
public static async Task Send(ActionMessage message, TenantInformation tenant, IWorkflowMessagingProcessor workflowMessagingProcessor) { Logger.Log($"Sending {message.ActionType} message with transaction ID '{message.TransactionId}' for tenant '{tenant.TenantId}': {message.ToJSON()}", message, tenant); await workflowMessagingProcessor.SendMessageAsync(tenant.TenantId, message); Logger.Log($"Successfully sent {message.ActionType} message", message, tenant); }