Skip to content

Commit

Permalink
chore(README): update/simplify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKujawa authored Jan 28, 2020
1 parent aee483e commit 4c20abe
Showing 1 changed file with 2 additions and 126 deletions.
128 changes: 2 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ for more information about the Zeebe project.

The Zeebe C# client is available via nuget (https://www.nuget.org/packages/zb-client/).

Please have a look at the [API documentation](https://zeebe-io.github.io/zeebe-client-csharp/).

## Camunda Cloud

The Zeebe C# Client is Camunda Cloud ready.
Expand All @@ -31,129 +33,3 @@ To get an example how to use the Zeebe C# Client with the Cloud take a look at [

Simply run `msbuild Zeebe.sln` or `dotnet build Zeebe.sln`

## Current supported Features

* Request topology
* JobWorker
* Activate Jobs
* Complete Job
* Fail Job
* Publish Message
* Deploy an resource
* Create a workflow instance
* Set variables on an element instance
* Update retries of an job
* Resolve an existing incident
* Cancel an existing workflow instance

## Examples

There exist an example project under `Client.Examples/`, which contains some of the examples below.
You can run the example with the following command:

```bash
dotnet run --project Client.Examples/Client.Examples.csproj
```

Make sure that you have an broker runing before you execute the examples.
Easiest way to run an broker is to use docker, see the following command:

```
docker run -p 26500:26500 camunda/zeebe:latest
```

### Client

To create a client use this:

```csharp
var zeebeClient = ZeebeClient.NewZeebeClient("localhost:26500");
```

### Request topology

```csharp
ITopology top = await zeebeClient.TopologyRequest().Send();
```

### Create an job worker

```csharp
zeebeClient.NewWorker()
.JobType("bar")
.Handler((client, job) =>
{
// business logic
})
.MaxJobsActive(5)
.Name("zb-worker")
.PollInterval(TimeSpan.FromSeconds(5))
.Timeout(10_000L)
.Open();
```

### Activate Jobs

```csharp
zeebeClient.NewActivateJobsCommand()
.JobType("foo")
.MaxJobsToActivate(3)
.Timeout(TimeSpan.FromSeconds(10))
.WorkerName("jobWorker")
.FetchVariables("foo", "bar")
.Send();
```

### Complete an job

```csharp
client.NewCompleteJobCommand(JobKey).Variables("{\"foo\":23}").Send();
```

### Fail an job

```csharp
client.NewFailCommand(job.Key).Retries(job.Retries - 1).ErrorMessage("This job failed.").Send();
```

### Deploy a resource

```csharp
var deployResponse = await client.NewDeployCommand().AddResourceFile(DemoProcessPath).Send();
```

### Create a workflow instance
```csharp
var workflowKey = deployResponse.Workflows[0].WorkflowKey;
var workflowInstanceResponse = await client
.NewCreateWorkflowInstanceCommand()
.WorkflowKey(workflowKey)
.Variables("{\"foo\":\"123\"}")
.Send();
```

### Set variables on an element instance

```csharp
await client.NewSetVariablesCommand(workflowInstanceResponse.WorkflowInstanceKey)
.Variables("{\"a\":\"newValue\"}")
.Send();
```

### Update retries of an job

```csharp
await client.NewUpdateRetriesCommand(45).Retries(2).Send();
```

### Resolve an existing incident

```csharp
await client.NewResolveIncidentCommand(17).Send();
```

### Cancel an existing workflow instance
```csharp
await client.NewCancelInstanceCommand(workflowInstanceResponse.WorkflowInstanceKey).Send();
```

0 comments on commit 4c20abe

Please sign in to comment.