From 548045d04a60c35f1909ebccda7d93cd414588fa Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Mon, 30 May 2022 15:29:08 +0800 Subject: [PATCH] Throw if matching barrier manager fails --- .../Abp/EventBus/Boxes/Dtm/DtmMessageManager.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/EasyAbp.Abp.EventBus.Boxes.Dtm/EasyAbp/Abp/EventBus/Boxes/Dtm/DtmMessageManager.cs b/src/EasyAbp.Abp.EventBus.Boxes.Dtm/EasyAbp/Abp/EventBus/Boxes/Dtm/DtmMessageManager.cs index 1185cda..7040b86 100644 --- a/src/EasyAbp.Abp.EventBus.Boxes.Dtm/EasyAbp/Abp/EventBus/Boxes/Dtm/DtmMessageManager.cs +++ b/src/EasyAbp.Abp.EventBus.Boxes.Dtm/EasyAbp/Abp/EventBus/Boxes/Dtm/DtmMessageManager.cs @@ -150,10 +150,22 @@ public class DtmMessageManager : IDtmMessageManager, ITransientDependency var barrierManagers = ServiceProvider.GetServices(); var databaseApi = await GetDatabaseApiAsync(model.DbConnectionLookupInfo.DbContextType); + + var inserted = false; foreach (var barrierManager in barrierManagers) { - await barrierManager.TryInvokeInsertBarrierAsync(databaseApi, DtmMsgGidProvider.Create()); + if (await barrierManager.TryInvokeInsertBarrierAsync(databaseApi, DtmMsgGidProvider.Create())) + { + inserted = true; + break; + } + } + + if (!inserted) + { + throw new ApplicationException( + $"No match DTM message barrier manager to {model.DbConnectionLookupInfo.DbContextType.Name}."); } } }