Persistence

Persistent Variables

The triggers and actions of a workflow may require specific data to be able to run properly. For example, a series of actions that use a database might all need access to the same database URL and table name. In such cases, it is often useful to store this shared data using flow chart variables so it can be easily referenced throughout the workflow.

Any variable that is stored in the database (such as a flow chart variable) is called a “persistent variable”. Flux automatically stores and retrieves flow chart variables as they are needed by triggers and actions.

For more information on how variables can be created, stored, and retrieved, see Variable Managers.

Rules for Persistent Variables

To store a variable in the database, it must conform to the following rules (these rules are listed in the order in which Flux applies them). If your persistent variable does not follow these rules, Flux will encounter an error and the variable will not be persisted to the database (and, if the variable that caused the error is used in a workflow, the workflow itself may encounter an error).

  1. Your variable can be any of the following basic data types (or an instance of the listed Java class). Note that “serialized data” refers to any instance of a class that implements java.io.Serializable.
    • boolean
    • byte
    • byte[]
    • char
    • char[]
    • double
    • float
    • int
    • long
    • short
    • java.lang.Boolean
    • java.lang.Character
    • java.lang.Character[]
    • java.lang.Float
    • java.lang.Integer
    • java.lang.Long
    • java.lang.Short
    • java.lang.String
    • java.math.BigDecimal
    • java.math.BigInteger
    • java.sql.Date
    • java.sql.Time
    • java.sql.Timestamp
    • java.util.Date
    • flux.FlowChart
    • serialized data
    • null
  2. Your persistent variable may be a Java collection from the java.util package (including List, Map, Set, SortedMap, or SortedSet). However, each item stored in the collection must also follow the rules for persistent variables (in effect, the rules are applied recursively to each item in the collection).
  3. Your persistent variable may be an array. If the variable is an array type that is not explicitly mentioned in rule #1, it will be treated as a List and must therefore follow the same rules as other collections (see rule #2 above).
  4. Your persistent variable may be a complex user-defined type. In this case, rules for persistence are applied recursively to each field on the variable, so any fields used in the custom variable must also follow the rules for persistence.

Because Flux variables are persisted in the database as XML, they do not support circular references (ObjectA contains ObjectB, which contains ObjectA, etc.).

If your variable contains a circular reference you may see an error like:

java.lang.StackOverflowError
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:147)
at java.beans.Introspector.getBeanInfo(Introspector.java:183)
at fluximpl.x7.a(x7.java:6)
at fluximpl.mcb.a(mcb.java:113)
at fluximpl.mcb.a(mcb.java:120)
at fluximpl.mcb.a(mcb.java:137)