From 32c3f1ff58fa3d5b7c38e8d463d6cc2f96dd3128 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 10 Sep 2026 17:58:11 +0800 Subject: [PATCH] Add migration guide note for the dynamic job and event tenant --- .../release-info/migration-guides/abp-10-7.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/en/release-info/migration-guides/abp-10-7.md b/docs/en/release-info/migration-guides/abp-10-7.md index 81d63bdc91..079c58f3fc 100644 --- a/docs/en/release-info/migration-guides/abp-10-7.md +++ b/docs/en/release-info/migration-guides/abp-10-7.md @@ -203,6 +203,31 @@ Upgrade the packages. There is no configuration change. Until you can upgrade, give every authorization server its own client signing key, so an assertion cannot be replayed across them. +### Tenant of Dynamic Background Jobs and Events + +**Who is affected** + +- Applications that enqueue jobs through `IDynamicBackgroundJobManager` with a runtime registered handler. +- Applications that publish string named dynamic events and handle them after an outbox or a message broker. +- Applications that derive from `DefaultDynamicBackgroundJobManager`, or that override `DistributedEventBusBase.AddToInboxAsync` or `AzureDistributedEventBus.PublishAsync(string, object)`. + +**What changed** + +- A dynamic handler job now runs under the tenant that enqueued it. `DynamicBackgroundJobArgs` implements `IMultiTenant` and `DefaultDynamicBackgroundJobManager` fills it from `ICurrentTenant`, so the existing `BackgroundJobExecuter` restores the tenant before the handler runs. Previously the transport args carried no tenant and the job ran under the host, because the worker thread has none. +- A string named dynamic event now runs under the tenant that published it. Its payload is arbitrary user data with no place for a tenant, so the tenant travels on the transport as the `X-Tenant-Id` header, next to the correlation id, and the message body is unchanged. Typed events keep carrying their tenant in the event data itself and are not touched: no header is written for them and their handlers behave exactly as before. +- `DefaultDynamicBackgroundJobManager` takes a new `ICurrentTenant` dependency, and `AddToInboxAsync` and the Azure `PublishAsync(string, object)` take a new optional tenant parameter. A derived class does not compile until its constructor or its override is updated. +- A tenant header that is present but is not a GUID fails the message instead of handling it under the host. +- Dapr is unchanged, because it does not support dynamic event subscriptions. + +**What to do** + +- Add the new parameters to your derived constructors and overrides. +- Review the dynamic handlers you register at runtime. A handler that reads host wide data while the job is enqueued from a tenant request now sees that tenant's data. Wrap such a handler in `using (CurrentTenant.Change(null))` if it has to run under the host, or enqueue the job inside the same scope. +- Drain or re-enqueue the jobs and the events that are still waiting from before the upgrade. They carry no tenant and keep running under the host. +- Upgrade the consumers before the producers in a tiered or microservice solution. A message published by an upgraded producer loses its tenant on a consumer that is not upgraded yet, the same way it did before the upgrade. + +> See [#26148](https://github.com/abpframework/abp/pull/26148) for details. + ### Dependency Updates **Who is affected**