![]() |
VOOZH | about |
dotnet add package zb-client-bootstrap --version 1.0.0
NuGet\Install-Package zb-client-bootstrap -Version 1.0.0
<PackageReference Include="zb-client-bootstrap" Version="1.0.0" />
<PackageVersion Include="zb-client-bootstrap" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="zb-client-bootstrap" />Project file
paket add zb-client-bootstrap --version 1.0.0
#r "nuget: zb-client-bootstrap, 1.0.0"
#:package zb-client-bootstrap@1.0.0
#addin nuget:?package=zb-client-bootstrap&version=1.0.0Install as a Cake Addin
#tool nuget:?package=zb-client-bootstrap&version=1.0.0Install as a Cake Tool
👁 BUILD
👁 ANALYZE
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 Total alerts
👁 alternate text is missing from this package README image
👁 Compatible with: Camunda Platform 8
👁 alternate text is missing from this package README image
This project is an extension of the C# Zeebe client project. Zeebe Job handlers are automaticly recognized and bootstrapped via a .Net HostedService.
Read the Zeebe documentation for more information about the Zeebe project.
The Zeebe C# client bootstrap extension is available via nuget (https://www.nuget.org/packages/zb-client-bootstrap/).
See examples and blog post for more information.
All classes which implement IJobHandler<TJob>, IJobHandler<TJob, TResponse>, IAsyncJobHandler<TJob> or IAsyncJobHandler<TJob, TResponse> are automaticly found, added to the service collection and autowired to Zeebe when you register this bootstrap project with the IServiceCollection.BootstrapZeebe() extension method.
The BootstrapZeebe method has two parameters:
ZeebeBootstrapOptions via configuration, action delegate or both.ConfigureServices((hostContext, services) => {
services.BootstrapZeebe(
hostContext.Configuration.GetSection("ZeebeBootstrap"),
this.GetType().Assembly
);
})
The job is an implementation of AbstractJob. By default the simple name of the job is mapped to BPMN task job type. Job types must be unique. The default job configuration can be overwritten with AbstractJobAttribute implementations, see attributes for more information.
public class SimpleJob : AbstractJob
{
public SimpleJob(IJob job)
: base(job)
{
//Variable mapping logic can be added here.
}
}
There is also a generic version AbstractJob<TState> which will automaticly deserialize job variables into a typed object. Each property is automaticly added to the FetchVariables collection when the FetchVariablesAttribute is not used.
public class SimpleJob : AbstractJob<SimpleJobState>
{
public SimpleJob(IJob job, SimpleJobState state)
: base(job, state)
{ }
}
public class SimpleJobState
{
public bool Test { get; set; }
}
The job handler is an implementation of IJobHandler<TJob>, IJobHandler<TJob, TResponse>, IAsyncJobHandler<TJob> or IAsyncJobHandler<TJob, TResponse>. Job handlers are automaticly added to the DI container, therefore you can use dependency injection inside the job handlers. The default job handler configuration can be overwritten with AbstractJobHandlerAttribute implementations, see attributes for more information.
public class SimpleJobHandler : IAsyncJobHandler<SimpleJob>
{
public async Task HandleJob(SimpleJob job, CancellationToken cancellationToken)
{
//TODO: make the handling idempotent.
await Usecase.ExecuteAsync(cancellationToken);
}
}
A handled job has three outcomes:
JobCompletedCommand beeing send to the broker. The TResponse is automaticly serialized and added to the JobCompletedCommand.AbstractJobException: this wil automaticly result in a ThrowErrorCommand beeing send to the broker;FailCommand beeing send to the broker;The JobCompletedCommand accepts variables which are added to process instance. For this use case the job handler can be use with a second generic parameter IJobHandler<TJob, TResponse>. The response is automaticly serialized.
public class SimpleJobHandler : IAsyncJobHandler<SimpleJob, SimpleResponse>
{
public async Task<SimpleResponse> HandleJob(SimpleJob job, CancellationToken cancellationToken)
{
//TODO: make the handling idempotent.
var result = await Usecase.ExecuteAsync(cancellationToken);
return new SimpleResponse(result);
}
}
IPublishMessageCommandStep3, ICreateProcessInstanceCommandStep3 and ISetVariablesCommandStep1 are extended with the State(object state) method which uses the registered IZeebeVariablesSerializer service to automaticly serialize state and pass the result to the Variables(string variables) method.This project uses the following conventions:
AbstractJob implementation is used to match the Type which is specified in the BPMN model. This can be overriden by adding the JobTypeAttribute to the AbstractJob implementation, see attributes for more information.Worker name. This can be overriden by adding the WorkerNameAttribute to the AbstractJob implementation, see attributes for more information.Transient service lifetime. This can be overriden by adding the ServiceLifetimeAttribute to the job handler, see attributes for more information.ZeebeVariablesSerializer is registered as the implementation for IZeebeVariablesSerializer which uses System.Text.Json.JsonSerializer. You can override this registration by registering your service after the BootstrapZeebe method or you can register System.Text.Json.JsonSerializerOptions to configure the System.Text.Json.JsonSerializer.Run dotnet build Zeebe.Client.Bootstrap.sln
Run dotnet test Zeebe.Client.Bootstrap.sln
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 16,917 | 9/21/2022 |
| 0.1.5 | 4,135 | 7/29/2022 |
| 0.1.4 | 588 | 7/29/2022 |
| 0.1.3 | 16,930 | 2/12/2022 |
| 0.1.2 | 742 | 2/2/2022 |
| 0.1.1 | 1,687 | 12/1/2021 |
| 0.1.0 | 569 | 11/17/2021 |
| 0.0.8 | 7,791 | 10/24/2021 |
| 0.0.7 | 510 | 10/21/2021 |
| 0.0.6 | 557 | 10/12/2021 |
| 0.0.5 | 511 | 10/12/2021 |
| 0.0.4 | 503 | 9/29/2021 |
| 0.0.3 | 509 | 9/6/2021 |
| 0.0.2 | 535 | 9/3/2021 |
| 0.0.1 | 528 | 9/2/2021 |
| 0.0.1-preview010 | 390 | 8/25/2021 |
| 0.0.1-preview007 | 396 | 8/25/2021 |
| 0.0.1-preview006 | 399 | 8/25/2021 |
| 0.0.1-preview005 | 413 | 8/23/2021 |