Kanject.Core.Channels.Annotations.Attributes
3.13.1
Prefix Reserved
dotnet add package Kanject.Core.Channels.Annotations.Attributes --version 3.13.1
NuGet\Install-Package Kanject.Core.Channels.Annotations.Attributes -Version 3.13.1
<PackageReference Include="Kanject.Core.Channels.Annotations.Attributes" Version="3.13.1" />
<PackageVersion Include="Kanject.Core.Channels.Annotations.Attributes" Version="3.13.1" />
<PackageReference Include="Kanject.Core.Channels.Annotations.Attributes" />
paket add Kanject.Core.Channels.Annotations.Attributes --version 3.13.1
#r "nuget: Kanject.Core.Channels.Annotations.Attributes, 3.13.1"
#:package Kanject.Core.Channels.Annotations.Attributes@3.13.1
#addin nuget:?package=Kanject.Core.Channels.Annotations.Attributes&version=3.13.1
#tool nuget:?package=Kanject.Core.Channels.Annotations.Attributes&version=3.13.1
Kanject.Core.Channels.Annotations.Attributes
Attribute-only package for Kanject channels: [Channel], [ChannelProducer], and the ChannelMode, ChannelFullMode and ChannelLifetime enums. It contains marker types only — no implementation. The Kanject.Core.Channels.Annotations source generator reads these attributes and emits the channel wiring.
Installation
Most projects never reference this package directly: Kanject.Core.Channels depends on it, so the attributes are available as soon as the runtime is installed.
dotnet add package Kanject.Core.Channels.Annotations.Attributes
Reference it directly only when you want the attribute types without the runtime — for example in a shared contracts assembly that declares handlers compiled elsewhere.
Targets netstandard2.0, .NET 8, .NET 9 and .NET 10. The netstandard2.0 build exists so the Roslyn generator, which must itself target netstandard2.0, can load the same types.
Usage
using Kanject.Core.Channels.Annotations.Attributes;
using Kanject.Core.Channels.Annotations.Attributes.Enums;
public sealed partial class OrderProjector
{
[Channel(
Capacity = 5000,
BatchSize = 25,
FlushIntervalMs = 200,
Mode = ChannelMode.InProcess,
Lifetime = ChannelLifetime.Scoped)]
public ValueTask ProjectAsync(ReadOnlyMemory<OrderPlaced> batch, CancellationToken ct)
{
// handle the batch
return ValueTask.CompletedTask;
}
}
To turn the attribute into code, add the Kanject.Core.Channels.Annotations generator to the project that declares the handler.
Attributes
[Channel] (methods)
Marks a method as a batched, async channel handler. The containing type must be partial.
| Property | Type | Default | Meaning |
|---|---|---|---|
Capacity |
int |
1024 |
Bounded channel capacity; must be > 0 |
FullMode |
ChannelFullMode |
Wait |
Behaviour when the channel is full |
BatchSize |
int |
1 |
Items per handler call; 1 means no batching |
FlushIntervalMs |
int |
0 |
Maximum wait before a partial batch is flushed; 0 disables time-based flushing |
Mode |
ChannelMode |
Default |
Generated consumer shape |
Lifetime |
ChannelLifetime |
Scoped |
How the handler is resolved per batch |
RestartOnFault |
bool |
true |
Keep draining after a handler fault |
MaxRestartAttempts |
int |
-1 |
Restart limit; -1 is infinite, 0 is invalid |
SafetyMarginMs |
int |
500 |
InvocationLocal only: time reserved before the Lambda deadline |
ChannelName |
string? |
null |
Channel name reported by the generated writer; defaults to {Type}_{Method} |
[ChannelProducer] (classes, multiple allowed)
Declares a producer-only port for an item type: [ChannelProducer(typeof(OrderPlaced))], with an optional ChannelName. The type is part of the public surface, but no generator emits code for it yet. Kanject.Core.Channels.Annotations reports every use as error KANCHN017, so the attribute can't compile into a silent no-op. For a producer-only port today, declare a [Channel(Mode = ChannelMode.Distributed)] handler: it generates the writer interface and DI extension without a consumer.
Enums
Namespace Kanject.Core.Channels.Annotations.Attributes.Enums.
| Enum | Members |
|---|---|
ChannelMode |
Default (generator picks InvocationLocal when Kanject.Core.CloudFunction.Provider.AwsLambda is referenced, else InProcess), InProcess (hosted BackgroundService consumer), InvocationLocal (Lambda inline drainer), Distributed (writer only; the consumer runs elsewhere) |
ChannelFullMode |
Wait (backpressure), DropOldest, DropWrite, DropNewest |
ChannelLifetime |
Scoped (new DI scope per batch), Singleton, Transient |
ChannelFullMode exists so this package does not need System.Threading.Channels. The generator maps each member to the BoundedChannelFullMode member of the same name (the two enums order their drop members differently, so the mapping is never numeric). A value outside the enum, such as (ChannelFullMode)42, is error KANCHN018. DropOldest removes the oldest buffered item to make room, DropNewest removes the newest buffered item, and DropWrite discards the item being written; all three lose data silently, which is why they raise warning KANCHN013.
Related packages
| Package | Role | Availability |
|---|---|---|
Kanject.Core.Channels |
Runtime engine; depends on this package | nuget.org |
Kanject.Core.Channels.Annotations |
Source generator and analyzers that consume these attributes | nuget.org |
License
Licensed under the Kanject Code Libraries License Agreement (KCLLA); the full text ships in this package as LICENSE.md. Organizations whose trailing-twelve-month gross revenue and total funding raised are each below US$250,000 may use it at no cost under the Free Tier. At or above either threshold a commercial license is required — contact commercial@kanjectbusiness.com.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Kanject.Core.Channels.Annotations.Attributes:
| Package | Downloads |
|---|---|
|
Kanject.Core.Channels.Annotations
Roslyn source generator + analyzers for Kanject channels — emits the channel writer interface, in-process hosted-service and invocation-local drainers, and keyed DI registration for [Channel]-annotated methods, with the KANCHN shape and configuration diagnostics ([ChannelProducer] is not yet supported and is reported as KANCHN017). |
|
|
Kanject.Core.Channels
Kanject Core Channels — the runtime for Kanject in-process / serverless channels: the batched, allocation-disciplined ChannelDrainer, ChannelHostedServiceBase, InProcessChannelWriter / IChannelWriter, and ChannelOptions. Attribute-driven writer/hosted-service/drainer/DI wiring is generated by Kanject.Core.Channels.Annotations. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.13.1 | 179 | 9/27/2026 |
| 3.13.0 | 141 | 9/27/2026 |
| 3.12.7 | 138 | 9/26/2026 |
| 3.12.6 | 171 | 9/7/2026 |
| 3.12.5 | 148 | 8/27/2026 |
| 3.12.4 | 158 | 8/22/2026 |
| 3.12.3 | 166 | 8/10/2026 |
| 3.12.2 | 161 | 8/9/2026 |
| 3.12.1 | 178 | 8/5/2026 |
| 3.12.0 | 174 | 8/5/2026 |
| 3.11.0 | 174 | 8/3/2026 |
| 3.10.5 | 183 | 7/30/2026 |
| 3.10.4 | 176 | 7/18/2026 |
| 3.10.3 | 194 | 7/13/2026 |
| 3.10.2 | 182 | 7/11/2026 |
| 3.10.1 | 185 | 7/11/2026 |
| 3.10.0 | 156 | 7/9/2026 |
| 3.9.1 | 177 | 7/9/2026 |