Java Action

The Java Action is used to execute Java code. To run your own Java code using this action, you will need to create a special class (called a listener class) that extends flux.ActionListener (see listener below for more details). The code from the actionFired() method of your listener class is executed when this action runs.

You can also pass in an optional key to provide data to your listener code. This is useful, for example, when you need to execute your code using data that is generated at the flow chart runtime.



The name (including the full package) of the listener class that this action will invoke – for example, mypackage.MyListener.

To invoke a listener class using the Java Action, the class must implement the flux.ActionListener interface. If you need to execute code from a class that does not implement this interface, you must use the Dynamic Java Action.

When the Java Action runs, it will execute the code from the actionFired() method of the listener class. As an example, the source code for a listener class could look something like:

public  class MyJobListener implements ActionListener {
   public Object actionFired(KeyFlowContext flowContext) throws Exception {
      System.out.println("My Listener has fired.");
//      Your code here...
      return null;

The KeyFlowContext object passed into the actionFired() method contains information about the current state of execution in the flow chart at the time the Java Action runs. You can find more information about this object by viewing the Javadoc for flux.KeyFlowContext.

You can also use the getKey() method of KeyFlowContext to access any key that is provided to the Java Action. This will return the key object (if any) that was set on the Java Action.


The key is an (optional) piece of data that can be passed to the listener code. The key can be any Java object that supports the Flux rules for persistent variables.

You can set the key to a static value when you create the flow chart, or use Runtime Data Mapping to pass in the key value from another action in the flow chart (for example, to pass the result of a previous action to your Java listener code).

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.