Repository navigation
5.0.0
Version 5.0 lets you use the regular Orleans streaming API on tenant streams: once you have a tenant stream, you subscribe, resume and unsubscribe exactly as you do with Orleans streams. It requires Orleans 10.4.
For how to upgrade, see Upgrade from 4.x to 5.0 in the readme.
Breaking changes
The breaking changes are limited to tenant streams and to the required Orleans version. Tenant grains, grain calls, cross-tenant authorization and tenant storage work as in 4.0.
- Orleans 10.4.0 or later is required. 4.0 required Orleans 10.0.1 or later.
- Subscription handles are regular Orleans handles.
TenantStream<T>.SubscribeAsyncandGetAllSubscriptionHandlesreturnStreamSubscriptionHandle<T>instead ofStreamSubscriptionHandle<TenantEvent<T>>. Where you declared the handle type, change it accordingly.TenantEvent<T>is no longer public. The serialized form of stream events is unchanged. - A handle that 4.x stored in grain state cannot be read. If your application stored a subscription handle in grain state with 4.x and you only change the type of the state member, the grain state fails to load and the grain cannot be activated. Give the state member a new name and a new
[Id], and get the handle fromGetAllSubscriptionHandles()when the grain is activated. The subscriptions themselves are not affected; they continue to work after the upgrade. onNextAsynchandlers get a nullable token. Like the OrleansSubscribeAsyncmethods since Orleans 10.3, the delegates take aStreamSequenceToken?. With nullable reference types enabled, declare the token parameter of your handler asStreamSequenceToken?to avoid warning CS8622.GetStream<T>(namespace, keyWithinTenant)takes the key as it is. It no longer accepts a key that includes the tenant ID. If you passed such a key (for examplethis.GetPrimaryKeyString()in a grain with an implicit subscription), passthis.GetKeyWithinTenant()instead, or useGetStream<T>(StreamId), which still accepts it.- A stream filter must be registered inside
AddMultitenantStreams. Registering a stream filter for the provider afterAddMultitenantStreamsnow fails silo startup with anOrleansConfigurationException. In 4.0 this silently disabled tenant separation for that stream provider.
New
- Resume subscriptions with the Orleans API.
ResumeAsyncon a handle, with an observer or with delegates, works for subscriptions to tenant streams. This makes it possible to resume explicit subscriptions when a grain is reactivated, as Orleans prescribes. - Implicit subscriptions with
IStreamSubscriptionObserver. UsehandleFactory.CreateTenantHandle<T>()inOnSubscribed; it is the tenant aware equivalent ofhandleFactory.Create<T>(). - Handles can be stored in grain state, to resume a subscription with the stored handle.
- More ways to subscribe.
SubscribeAsyncnow also takes batch delegates, and aStreamSubscriptionStartPositionto start at the latest or at the earliest available event (new in Orleans 10.4). - Stream filters. A stream filter that is registered in the
addStreamProviderfunction ofAddMultitenantStreamsis applied to events that were sent with the tenant aware API; it receives the events as they were sent. - Any string is a valid stream key within a tenant, as it already was for grain keys.
- Storage providers with extra constructor parameters, such as Azure Blob Storage: when a tenant storage provider cannot be created, the exception now explains that
getProviderParameterscan supply these parameters, and the readme has an Azure Blob Storage example (#15).
The readme has examples for subscribing, resuming and stream filters.
Fixed
TenantStream<T>.OnNextBatchAsyncthrew anInvalidCastException.StreamId.GetTenantId()returned an incorrect value.GetStream<T>(namespace, keyWithinTenant)threw anArgumentException, or returned a stream with a different key, when the key contained the|character.- A stream filter that was registered in
addStreamProviderwas silently ignored.
Commits
- 7c358d8 Update editorconfig to Version 20260205 - C# 14; bump nuget version
- 16b356d Update README with agentic engineering support info
- c6d3b93 Update README
- 7e4bf83 update with agentic.check 2.4.1
- 0e4c2be Version 5.0: transparent stream subscription handles, stream filters, stream keys
- d97d838 Target Orleans 10.4.0: subscription start positions, nullable annotations
- ea71cc8 Keep the multitenant-local NuGet feed folder in git, re-enable the feed
- 6f72792 README: stream samples for 5.0, current Azure Table storage sample
- 50b1769 Explain getProviderParameters when a tenant storage provider cannot be created
- 6498986 Generate the release notes link in the NuGet readme from PackageVersion
- 1958e52 update code in readme screenshot
- bdb6cda Example: Orleans.Multitenant 5.0.0, latest dependencies, in-memory storage fallback
Merged with #16.
Full Changelog: 4-0-0...5-0-0