Best pratice for external dto

Hey,

I’m evaluating camunda for some use cases and I want to create a PoC for my project. I’m not sure how to handle external DTOs in a good manner. Of course I only want to save ref ids for my DTO and use the necessary data in my process. At some point I need all the data for displaying it to the user.
For example the camunda twitter example: https://camunda.com/best-practices/handling-data-in-processes/

I want to build embedded forms for displaying the whole tweet with meta data (time stamp, user, avatar, etc) from the external system. In the beginning I have only the ID. At which time and where should I fetch the additional data for one activity?

Should I create a HTTP get request from the form itself (direct/proxy servlet) or can I create an event listener in the activity “Review tweet” to enrich the task data from a delegate and use these values in my embedded form?

Thank you for you help!

Best regards,
Dennis

Hello Dennis

That is correct, that you should store in camunda only key - reference to your data.
I would suggest that you load the ref ids for your DTOs at client side (embedded form) according fetching-an-existing-json-variable.
Then you use any allowed client side technology to load your DTOs. It can be Ajax/Rest/GraphQL or even MongoDB over http
When data are loaded you can present then to user using power of angular, jquery or bare javascript.

As concern loading data with event listener. Yes, it is an option as well, but consider the followind

  • Event listener is called only once. if the user task is not processed imidiatelly, then data could be stale.
  • Data would be historized in camunda db. Good: you can have a snapshot to debug issues. Bad: it can blow up db and slow up searches.

I hope it helps
Roman

Hi @Dennis_Tietz,

Have a look at the following post

If applicable use business key to store the value of business identifier to make things easier and more readable.

Hey, thank you both for the fast and good answer. As expected I will try to fetch the data via REST or GraphQL from the embedded form.