Code Monkey home page Code Monkey logo

camunda.api.client's Introduction

Camunda REST API Client Build status NuGet

Camunda REST API Client for .NET platform

  • .NET Framework 4.6.1
  • .NET Standard 2.0

Covered API

Each part listed below is fully covered according to https://docs.camunda.org/manual/latest/reference/rest specification.

Install

The Camunda REST API Client is available on nuget.org

To install Camunda REST API Client, run the following command in the Package Manager Console

PM> Install-Package Camunda.Api.Client

Usage

Initialize client

CamundaClient camunda = CamundaClient.Create("http://localhost:8080/engine-rest");

Basic Authentication

HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost:8080/engine-rest");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic ZGVtbzpkZW1v");
CamundaClient camunda = CamundaClient.Create(httpClient);

Filter external tasks

// build query
var externalTaskQuery = new ExternalTaskQuery() { Active = true, TopicName = "MyTask" };

// add some sorting
externalTaskQuery
    .Sort(ExternalTaskSorting.TaskPriority, SortOrder.Descending)
    .Sort(ExternalTaskSorting.LockExpirationTime);

// request external tasks according to query
List<ExternalTaskInfo> tasks = await camunda.ExternalTasks.Query(externalTaskQuery).List();

Get all external tasks

// get all external tasks without specifying query
List<ExternalTaskInfo> allTasks = await camunda.ExternalTasks.Query().List();

Set process variable

VariableResource vars = camunda.ProcessInstances["0ea218e8-9cfa-11e6-90a6-ac87a31e24fd"].Variables;

// set integer variable
await vars.Set("Var1", VariableValue.FromObject(123));

// set content of binary variable from file
await vars.SetBinary("DocVar", new BinaryDataContent(File.OpenRead("document.doc")), BinaryVariableType.Bytes);

Load typed variables

var executionId = "290a7fa2-8bc9-11e6-ab5b-ac87a31e24fd";
// load all variables of specified execution
Dictionary<string, VariableValue> allVariables = await camunda.Executions[executionId]
    .LocalVariables.GetAll();

// obtain strongly typed variable with name Var1
int myVar1 = allVariables["Var1"].GetValue<int>();

Save content of variable to file

HttpContent fileContent = await camunda.Executions[executionId]
    .LocalVariables.GetBinary("file1");

using (fileContent)
{
    using (var outStream = File.OpenWrite("file1.doc"))
    {
        (await fileContent.ReadAsStreamAsync()).CopyTo(outStream);
    }
}

Message correlation

var msg = new CorrelationMessage() { All = true, MessageName = "TestMsg" };

msg.ProcessVariables
    .Set("Date", DateTime.Today)
    .Set("ComplexVar", new { abc = "xyz", num = 123});

// correlate message with process variables
await camunda.Messages.DeliverMessage(msg);

Deploy resources

// deploy new bpmn diagram with some attachment
await camunda.Deployments.Create("My Deployment 1",
    new ResourceDataContent(File.OpenRead("C:\\diagram.bpmn"), "diagram.bpmn"), 
    new ResourceDataContent(File.OpenRead("C:\\document.doc"), "document.doc"));

Conditional query

// get all jobs owned by Process_1 with DueDate in the future
var jobQuery = new JobQuery() { ProcessDefinitionKey = "Process_1" };
jobQuery.DueDates.Add(new ConditionQueryParameter() 
{
    Operator = ConditionOperator.GreaterThan, Value = DateTime.Now
});

var jobs = await camunda.Jobs.Query(jobQuery).List();

License

This project is made available under the MIT license. See LICENSE for details.

camunda.api.client's People

Contributors

amrbadawy avatar cstaubli avatar darrenhull avatar diedu89 avatar flyingpie avatar gaensebluemchenritter avatar jlucansky avatar petermwood avatar sclstefan avatar windischb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

camunda.api.client's Issues

Make it possible to retrieve external task error Details

Good day,
Is there any way to obtain errorDetails for a failed external task? The ExternalTaskInfo class does not have errorDetails property and I do not see any action available for External Tasks service in this client library that can be able to obtain that information.
Using postman I have checked that I have to call the following endpoint to obtain the error details for failed external task which works fine:
GET /external-task/{id}/errorDetails.
Here I find the other issue - according to the Camunda REST API Reference documentation there is no such endpoint available at all. Does that mean that retrieving errorDetails for a failed external task is not officially supported?

More samples

Hi,

It'd be very helpful if you could add more samples:

  1. how to start a process
  2. how to retrieve and complete task

Thank you.

Cannot test handling of ApiExceptions because there is no public constructor

As it states in the title - in our project we cannot unit test the handling of ApiException or derived Exceptions, because they don't expose any public constructor.

While we have been able to mitigate the absence of interface definitions for CamundaClient, *Service classes and *Resource classes so far (by defining wrapper interfaces and classes), we cannot do so with the exceptions. Since we want to handle ApiExceptions differently to other exceptions and we want to test this behavior, some way of creating an ApiException (and specific derived exceptions) would be more than handy.

Add Version interface to package

Would be nice to see the Version interface in the package. It would a) allow to fetch the version of the Camunda engine easily and b) can be used to do simple health checks.

External task client?

Hello,

I'm curious if this client library can perform the same functionality as Camunda's own official external task client javascript module? In that JS module, you can subscribe to camunda topics.

I don't see topics mentioned in the readme of this library.

Does this library allow me to code an external task client in C#?

Thanks!

Trouble completing a task requiring a Date

When I try to complete a Task using the Complete method from the UserTasks[] I get
{"type":"InvalidRequestException","message":"Cannot complete task 2b63deab-f327-11e9-bcfd-0242ac110002: Cannot convert value '2019-10-10T00:00:00' of type 'Date' to java type java.util.Date"}

My code looks like this:

        public void Complete( string taskId )
        {
            var variables = new CompleteTask();
            var exampleDate = new DateTime( 2019, 10, 20 );
            var camundaExampleDate = VariableValue.FromObject( exampleDate );
            variables.SetVariable( nameof( exampleDate ), camundaExampleDate );

            _client.UserTasks[ taskId ].Complete( variables ).Wait();
        }

the task variable is defined as follow

<camunda:formField id="exampleDate" label="exampleDate" type="date" />

Am I doing something wrong?

Wrong version in nuGet 2.4.2

I still get Java date exceptions even after updating my nuGet to version 2.4.2 so I decided to decompile dll and saw that latest version of the code is not included in nuGet.

image

Serializing complex objects from Camunda.Api.Client and accessing them in workers

Hello, I have an asp netcore 3.1 application that connects to the vanilla docker camunda image. We are solely using external workers that are implemented with the Camunda.Worker library.

I want to pass complex object to a running instance, form my aspnet api project, however whatever I tried I am getting the error:

Type Object not in [Json]

the code I am using for starting a process instance with complex variables:

pseudo code:

           public class ComplObject {
                public string prop1 {get; set;}
           }
            var myObjectVariable = new ComplObject { prop1 = "abc"} 

            var processParams = new StartProcessInstance
            {
                BusinessKey = "my business key",
                SkipIoMappings = false,
                Variables = new Dictionary<string, VariableValue>
                 {
                     "myComplexObject", VariableValue.FromObject(myObjectVariable )
                 }
            };

            Camunda.ProcessDefinitions[someId].StartProcessInstance(processParams);

Later when I try to obtain the variable from a worker, I am getting the above-mentioned error Type Object not in [Json]

I saw lots of tests in Camunda.Worker project and being only in the context of Camunda.Worker I have no problems using the methods like .AsJson .AsString.

I think there is something around Camunda.Api.Client.VariableValue and Camunda.Worker.Variable classes that I am missing.

the only workaround so far for me is to pass an instance of Camunda.Worker.Variable to the Camunda.Api.Client.VariableValue.FromObject method, explicitly stating the ValueType.Json. However later on, when I want to obtain the typed variables from a worker, I need to do this extra hacky code:

JsonConvert.DeserializeObject<Variable>(camundaVariable.Value.ToString()).AsJson<T>();

I wonder what am I doing wrong.

Please advice

System.MissingMethodException

After investigation for few hours i finally found the reason of that exception.

This package is not compatible with refit version greater than 4.7.9 even if the Nuget dependencies doesn't specify it.

image

Tests and refactoring

Hi there,

looking into Camunda.Api.Client we see that there are only two tests - and they are failing right now (at least we cannot get them to work in the master branch). We also see, that many class definitions are within other classes files, sometimes even within other classes - not sure, if that was indeed done on purpose or just out of convenience, but it makes it very hard to actually find some of the classes ...

So we have thought about a refactoring of the project and redoing the tests - and adding tests whenever we have the time. Also we think about introducing just enough interface-definitions to be able to unit test user code rather easily instead of using wrapper interfaces and classes in order to do so.

A first starting point for a discussion can be found here:
https://github.com/gaensebluemchenritter/Camunda.Api.Client/tree/Refactoring

Both tests are working right now and restructuring as well as pulling out embedded classes is done. Additional interface-definitions are still missing, however ...

Disclaimer: this is not meant as criticism, but we strongly believe that restructuring and refactoring the code will help in the future, making it easier to actually apply changes, enhancements, bugfixes, ... this also is naught but a starting point for a discussion, if this would indeed be helpful and if the structure is valid and self-explanatory enough. If there is no intention of thinking about stuff like that, it is ok - I just thought it could be interesting enough to talk about it.

Completing task with List or Array input

Hi,
i am trying to complete the task using List from .net application and the list input will be used for parallel execution in a Sub-process . But now the camunda system is not able to iterate though the input as the type is 'java.lang.Object'.

Do you have any sample with completedtask.SetVariable with List or Array as input?

Thanks,
Eapen T John

JsonSerializationException when dealing with Json objects in external tasks

When working with embedded javascript in camunda, it seems that the best way to deal with strings that represent json objects is to convert them with the spin method "S()" and storing them in the format returned by this method, in the camunda rest api this types of objects are returned with a type of "Json" like in the example:

 "Item":
                {
                    "type": "Json",
                    "value": "{"ItemType":0,"Format":"","SourceFormat":9,"SourcePath":"\\\\LOCALHOST\\pathtofile\file.txt","Sample":1,"number":2,"allow":true},"SampleDetails":null}",
                    "valueInfo":
                    {
                    }
                }

This representation will result in an exception when trying to pull an external task using the library as it cannot find a type of Json, I believe this is a bug as the library should be able to figure out that the Json type served by camunda is basically a string.

Exception bellow.


System.AggregateException occurred
  HResult=-2146233088
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
       at System.Threading.Tasks.Task`1.get_Result()
       at IN.Infrastructure.Workflow.Impl.CamundaWorkflowConsumer.Acquire() in e:\IN\IN.Infrastructure\IN.Infrastructure.Workflow\Impl\CamundaWorkflowConsumer.cs:line 97
  InnerException: 
       HResult=-2146233088
       Message=Error converting value "Json" to type 'Camunda.Api.Client.VariableType'. Path '[0].variables.DistributionItem.type', line 1, position 773.
       Source=Newtonsoft.Json
       StackTrace:
            at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
            at Newtonsoft.Json.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
            at Camunda.Api.Client.VariableValue.VariableValueJsonConverter.PopulateMember(String memberName, JsonReader reader, JsonSerializer serializer, Object target)
            at Camunda.Api.Client.VariableValue.VariableValueJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
            at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
            at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
            at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
            at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
            at Refit.RequestBuilderImplementation.<>c__DisplayClass12_0`1.<<buildCancellableTaskFuncForMethod>b__0>d.MoveNext()
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
            at IN.Infrastructure.Workflow.Impl.CamundaClientContainer.<FetchAndLock>d__d.MoveNext() in e:\IN\IN.Infrastructure\IN.Infrastructure.Workflow\Impl\CamundaClientContainer.cs:line 60
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
            at IN.Infrastructure.Workflow.Impl.CamundaWorkflowConsumer.<AcquireAsync>d__2.MoveNext() in e:\IN\IN.Infrastructure\IN.Infrastructure.Workflow\Impl\CamundaWorkflowConsumer.cs:line 149
       InnerException: 
            HResult=-2147024809
            Message=Requested value 'Json' was not found.
            Source=mscorlib
            StackTrace:
                 at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
                 at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
                 at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
                 at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
                 at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
            InnerException: 

DateTime(Offset)

So it occurred to me that Camunda internally uses Joda Time, which includes time zone information (eg. offsets).

As of now, the client api encapsulates these using System.DateTime. I have a proposed changeset in here, changing these to System.DateTimeOffset, including a bit of serialization fluff: https://github.com/flyingpie/Camunda.Api.Client/pull/3.

Though, I would really like some unit tests before rolling this into master.

Now, here are some thoughts:

  • We could extent the unit test project, though I'm skeptic about how much actual safety it will provide, especially considering the amount of work to mock each and every api response. Also not gonna be fun when a new version of Camunda rolls around. I think it can be used to do some basic testing, but I don't know about full test suite.
  • We could add a set of integration tests, that actually hit the api. A simple docker container script can be added to spin up a bare bones Camunda instance with H2 database and have process definitions included in the test set. Some early hacking proved this to be a doable without to much hassle.
  • Such integrations tests could be of use in providing usage examples, and CI's such as Appveyor support docker as well.

I would be happy to provide you with a PR showing how this could work.

@jlucansky Whatever your thoughts are, please let me know :)

Business Key property missing from External Task

Whenever you make a call using the fetch and lock method on External Tasks, the returned object doesn't have the businessKey property. Seems like the business key (businessKey) property is missing from the ExternalTaskInfo.cs file. Can this be added considering it's returned in the Camunda API as a property from the fetch call?

https://docs.camunda.org/manual/latest/reference/rest/external-task/fetch/

Is this intentionally left out?

A quick and dirty solution is to make another query to get the process instance (which does have the business key property), but it seems like adding the business key to the external task object would be a more correct solution.

Deserialization fails with null target value

Hi, I'm trying to use Decision Definition service from your lib, but it fails at final deserialization in method PopulateMember inside VariableValue
protected virtual bool PopulateMember(string memberName, JsonReader reader, JsonSerializer serializer, object target)
because object target parameter - null and it causes an exception during deserialization here:

                if (fieldInfo != null) 
                {
                    reader.Read();
                    fieldInfo.SetValue(target, serializer.Deserialize(reader, fieldInfo.FieldType));
                    return true;
                }

with message

Newtonsoft.Json.JsonSerializationException: 'Cannot convert null value to Camunda.Api.Client.VariableType. Path 'path-value', line 1, position 39.'

HTTP response returns with status code 200.

Any ideas on how it could be fixed?

Querying UserTasks

Hi,

can you please tell me how to query UserTasks. Querying external Tasks works fine, but when I call

List<Camunda.Api.Client.UserTask.UserTaskInfo> allUserTasks = await camunda.UserTasks.Query(taskQuery).List();

no results are returned. What am I doing wrong?

Best regards
Stefan

Delivery message request

Hi all,

there is a problem with the executions of "/engine-rest/message".

Here is my code:

        var _corrMsg = new CorrelationMessage
        {
            MessageName = "msg_start_maintenance",
            BusinessKey = null,
            CorrelationKeys = null,
            ProcessInstanceId = "0f177e4c-d596-11ea-8ba8-e65e375919a1",
            ProcessVariables = null,
            TenantId = null,
            WithoutTenantId = true,
            ResultEnabled = false,
            All = false
        };

        var res = await camunda_client.Messages.DeliverMessage(_corrMsg);

Response: ENGINE-13028 Cannot specify a tenant-id when correlate a message to a single process instance.

Thanks in advance for your help.

Use `ErrorMessageHandler` with a custom HttpClient

The constructor of CamundaClient allows for an httpClient parameter. We use this overload, because it gives us the ability to configure the client to use authentication.

Unfortunately this makes that we cannot use the default ErrorMessageHandler class, as it is internal.

Could this class be made public? So we can use it with a custom HttpClient?

support sending Signals with "/signal"

Since Camunda Platform 7.8 there is an additional route "/signal" to send signals to specified executions or to all subscribed handler. It would be super cool, if you can manage to implement this. Unfortunately i don't have time for that yet.

greets Ephraim

How do you start a process?

I am looking to use this and was wondering if someone could help me with starting a process with and without variables defined?

I managed to do some simpler requests and I am having trouble finding any documentation or test cases.

Delete with cascade: true doesn't work.

Calling client.Deployments[deployment.Id].Delete(cascade: true) doesn't work. It results in an HTTP 500 response with a response message like:

ENGINE-03076 Deletion of process definition without cascading failed. Process definition with id: 7821f9ad-7b76-11e8-9145-0242ac120004 can't be deleted, since there exists 1 dependening process instances.

After some more digging, I found that the HTTP call being done is:

HTTP DELETE /deployment/7820730b-7b76-11e8-9145-0242ac120004?cascade=True&skipCustomListeners=False&skipIoMappings=False

This should be (difference is in casing)

HTTP DELETE /deployment/7820730b-7b76-11e8-9145-0242ac120004?cascade=true&skipCustomListeners=false&skipIoMappings=false

Http basic authentication.

Hi there,

I am looking forward to using your library for a project, but I need the ability to use basic http authentication from it, which seems to be missing, would you consider pushing a new change to the CamundaClient.cs that would allow passing an HttpClient object in a new constructor so RestService.For can be called using a string or the HttpClient object? I am attaching the patch.

patch.txt

Thank you for considering this and hoping this may make it to your library & the corresponding NuGet
package.

Best Regards.
Samuel Meza

CorrelationMessage BusinessKey default value

Hi, the code snippet below won't work cause BusinessKey default value is set to "".
Camunda will try to look for processInstanceId with BusinessKey == "" and that will most likely fail

var camundaClient = CreateCamundaClient();
var processInstanceId = await GetProcessInstanceIdByUniqueVariable("uniqueVariable", uniqueVariableValue);
var message = new CorrelationMessage() { ProcessInstanceId = processInstanceId, MessageName = "messageName"};
await camundaClient.Messages.DeliverMessage(message);

Maybe you should consider deleting default value
Sending this JSON directly to camunda rest engine will succeed, executing (in my case interrupting) message in given process instance

{
  "messageName": "messageName",
  "processInstanceId": "processInstanceId"
}

Ofc. following will also work

{
  "messageName": "messageName",
  "processInstanceId": "processInstanceId",
  "businessKey": null
}

Setting BusinessKey to null in constructor will also work, but doing that is not obvious.

var camundaClient = CreateCamundaClient();
var processInstanceId = await GetProcessInstanceIdByUniqueVariable("uniqueVariable", uniqueVariableValue);
var message = new CorrelationMessage() { 
  ProcessInstanceId = processInstanceId, 
  MessageName = "messageName", 
  BuisnessKey = null
};
await camundaClient.Messages.DeliverMessage(message);

BadRequest Exception on calling client.UserTasks[id].Variables.SetBinary()

Hi @jlucansky,
I faced with an internal exception on calling client.UserTasks[id].Variables.SetBinary. the server returns error 400 BadRequest. I got the source and stepped into SetBinary and then stepped into Refit to find out the reason of Bad Request. Guess what, the data and valueType is serialized as application/json.

You could test it with a unit test or at least read response error content and throw BadRequestException with more detail.

However, this is a lack of feature in Refit that I will ask them for support of HttpContent in Multipart

DateTime Serialisation

When using this library to get User Tasks that have been activated within the last minute I get the following error:

Camunda.Api.Client: Can not construct instance of java.util.Date from String value '2019-02-05T09:48:46.1118058Z': not a valid representation (error: Failed to parse Date value '2019-02-05T09:48:46.1118058Z': Unparseable date: "2019-02-05T09:48:46.1118058Z")
at [Source: org.camunda.bpm.engine.rest.filter.EmptyBodyFilter$1$1@70085f00; line: 1, column: 128] (through reference chain: org.camunda.bpm.engine.rest.dto.task.TaskQueryDto["createdAfter"]).

The code I am using is:

            var camunda = CamundaClient.Create("http://localhost:8052/engine-rest");
            var humanTaskQuery = new TaskQuery() { Active = true };
            humanTaskQuery.CreatedAfter = DateTime.UtcNow.AddMinutes(-1);
            var userTasks = await camunda.UserTasks.Query(humanTaskQuery).List();

            foreach (var task in userTasks)
            {
                log.LogInformation($"Human Task {task.FormKey} Activated");
            }

So this appears to be a simple datetime formatting issue, however this library does not provide a way to override the serializer settings.

I'm also wondering if i'm doing something wrong as most people should have run into this issue? Is this the best way to just get newly activated tasks?

Submit File when starting a new Process

Is there any support for submitting/uploading any kind of file when submitting the starting Form for a process, so far I am only able to submit it as bytestream but I don't how to submit as an actual file.

Sincerely,
Mike

Historic Process Instance missing fields: removalTime, rootProcessInstanceId & processDefinitionVersion

https://docs.camunda.org/manual/7.15/reference/rest/history/process-instance/get-process-instance/

rootProcessInstanceId String The process instance id of the root process instance that initiated the process.
removalTime String The time after which the instance should be removed by the History Cleanup job. Default format* yyyy-MM-dd’T’HH:mm:ss.SSSZ.
processDefinitionVersion Integer The version of the process definition that this process instance belongs to.

Disable/Handle Exceptions

Hello,
We r using Camunda in our productive System and communicating with it via Camunda.Api.Client. One essential Part is to fetch Task-Variables even if they are not set. In this case every time an exception is thrown. I want to check the HttpResponse myself, without catching anything since this is unperformant.
Would it be an idea to include a 2nd Interface which receives ApiResponse<T> from Refit to manually handle the response?
I would implement it by myself for our use case, with the option to adapt the hole api and open a pull request.

greets
Ephraim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.