Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/TechnoBerry/camunda-worker-dotnet

Ultimate solution to connect your ASP.NET Core application to Camunda external tasks
https://github.com/TechnoBerry/camunda-worker-dotnet

asp-net-core camunda csharp external-task

Last synced: about 2 months ago
JSON representation

Ultimate solution to connect your ASP.NET Core application to Camunda external tasks

Awesome Lists containing this project

README

        

# Camunda.Worker

[![codecov](https://codecov.io/gh/AMalininHere/camunda-worker-dotnet/branch/master/graph/badge.svg)](https://codecov.io/gh/AMalininHere/camunda-worker-dotnet)
[![NuGet](https://img.shields.io/nuget/v/Camunda.Worker.svg)](https://www.nuget.org/packages/Camunda.Worker)

## Example

```csharp
[HandlerTopics("sayHello", LockDuration = 10_000)]
[HandlerVariables("USERNAME")]
public class SayHelloHandler : IExternalTaskHandler
{
public async Task HandleAsync(ExternalTask externalTask, CancellationToken cancellationToken)
{
if (!externalTask.TryGetVariable("USERNAME", out var usernameVariable))
{
return new BpmnErrorResult("NO_USER", "Username not provided");
}

var username = usernameVariable.Value;

await Task.Delay(1000, cancellationToken);

return new CompleteResult
{
Variables = new Dictionary
{
["MESSAGE"] = new StringVariable($"Hello, {username}!"),
["USER_INFO"] = JsonVariable.Create(new UserInfo(username, new List
{
"Admin"
}))
}
};
}
}
```