What is the best practice to pass huge Object with several attributes to process variable

I have Order object which I want to pass to service task but it is huge. Is there a best practice to pass this as a process variable ?

Hi @Vinaya_Nayak,

If the data to be consumed by a service task implemented as Java delegate then it might worth passing it as transient variable so it doesn’t get saved into the database.

https://docs.camunda.org/manual/7.15/user-guide/process-engine/variables/#transient-variables

2 Likes

hassangThanks for the quick reply. The way this variable can be accessed in the JavaDelegate is same as accessing any other process variable?

Order order = (Order) execution.getVariable(“order”);

Hi @Vinaya_Nayak,

Yes, reading transient variables is no different from reading regular variables.

Below is an example of creating a transient variable.

com.example.Order order = new com.example.Order();
TypedValue typedTransientObjectValue = Variables.objectValue(order, true).create()
2 Likes