Camunda与SpringBoot:JSON在64 KB后截断。

huangapple go评论76阅读模式
英文:

Camunda with SpringBoot: JSON gets cut off after 64 KB

问题

Sorry, I'm here to help you with your request regarding creating a program framework for an automated Chinese paper writing system based on the information in the "lunwen.txt" file. If you have any questions related to that, please let me know.

英文:

We are relatively new to Camunda and working on a project at the moment that is giving us a few headaches.

We’ve got a SpringBoot-application with an Angular-Frontend that is supposed to take the data to start a process and send them to our Camunda-engine via REST-API. Aside from regular Strings and integer values we also need files (mainly PDF and Word), which are base64-encoded in the Angular-Frontend and can therefore become a bit larger.

The problem is, the variables (including the files) are encoded into JSON and when the size of the JSON surpasses 64 KB, we get an “Unexpected end-of-input in VALUE_STRING”-exception. Our application is encrypted via SSL (openSSL, created the certificate ourselfs via certbot and added configuration to application.yaml), if that should make any difference.

A few bullet-points also relevant:

  • Locally (running Windows 10 or in a VM on CentOS) it is working with no problems
  • When trying to start the process via the Camunda Tasklist it also only works if there are no files larger than 64kb attached, without the files the process is starting just fine
  • There server where the problem appears is a VM from Strato running Ubuntu, using openJDK 13.0.1 and a PostgreSQL-database
  • Usucally we are also connected to our AzureAD (thats why we needed SSL), but switched this off for testing, so this should not be the issue. Mentioning it just in case

Did anybody ever encounter something like that?


Here’s the uppermost part of the exception in question:

Unexpected end-of-input in VALUE_STRING
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 65] (through reference chain: org.camunda.bpm.engine.rest.dto.PatchVariablesDto[“modifications”]->java.util.LinkedHashMap[“file_b5b5576b_Object”]->org.camunda.bpm.engine.rest.dto.VariableValueDto[“value”])

Here the SSL-part from our application.yaml

  ssl:
    key-store-type: PKCS12
    key-store: classpath:keystore.p12
    key-alias: tomcat
    key-store-password: asdfGH12
    enabled: true

Anybody any ideas what might be causing our problems?
Thanks in advance and cheers!

答案1

得分: 0

Wladmir的评论是正确的。您不应该在工作流引擎的审计跟踪中存储大量数据,也不应将其用作记录系统。相反,应该拥有一个专门管理数据的服务,并且在流程变量中只存储数据对象的引用/主键(原因包括关注点分离、性能、可维护性、对其他客户端的可访问性、数据隐私、加密等)。

然而,如果您确实在流程变量中存储JSON,请将其存储为对象,而不是字符串,并告诉Camunda如何进行序列化/反序列化(SerializationDataFormat)。

以下示例展示了如何使用JAVA API完成这个过程:

https://github.com/camunda-consulting/code/blob/4a62d4b44efb126b50f22a6f17273c7c98f8b6da/snippets/rest-service-task-spring/src/main/java/org/camunda/example/service/RestDelegate.java#L33

英文:

Wladmir's comment is correct. You should not store huge amounts of data in the audit trail of a workflow engine and not use it as a system of records. Instead have a service which owns the data and only carry a reference / primary key for the data object in a process variable (reasons include separation of concerns, performance, maintainability, accessibility from other clients, data privacy, encryption,....).

However, if you do store JSON in a process variable, do not store it a as a String but as an object and tell Camunda how it is de/serialized (SerializationDataFormat).

This example shows you how this is done using the JAVA API:

https://github.com/camunda-consulting/code/blob/4a62d4b44efb126b50f22a6f17273c7c98f8b6da/snippets/rest-service-task-spring/src/main/java/org/camunda/example/service/RestDelegate.java#L33

huangapple
  • 本文由 发表于 2020年8月11日 15:47:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/63353738.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定