Working with XML in the Flower management tool

Some types of directory entries have payload in form of XML BLOB. Service containers and processor endpoint configurations, message data, process states are all stored as XML. Therefore, it is important to know how to manipulate XML in the Flower management tool.

Fixing a failed process

Flower scripting API provides means to save/load an XML file and print XML to stdout in human readable form. This may be useful if you need to fix a data of a process stopped in error.

Suppose you have a process id (pid) and you need to change the state of the process to recover it from a failure. First, you need to load its current state.

var pid = '#12345';
var proc = loadProcess(pid);

Now in 'proc' you have an object with two attributes:
  • process - the process entry.
  • currentState - the current state of the process.

The 'loadProcess' call will return null if the process with the given pid doesn't exist.

The state entry has an attribute 'data' which is an XML BLOB. You can save it to the file system by using $fs object.


The XML will be saved in human-readable form. You can also call the global 'print' or 'println' function to render the XML on the screen if you're using interactive mode.


As you've saved the XML in the file system, you can edit it with any text editor.

To change the process state, you need to load the amended XML, assign it to the 'data' attribute of the current state and save the state to the directory. = $fs.loadXml('state.xml', BLOB_FORMAT_GZIP);

$, proc.currentState);

When you load XML you have to specify the format of the BLOB which will store it. There are the following formats:
  • BLOB_FORMAT_BIN - binary encoded XML.
  • BLOB_FORMAT_GZIP - compressed plain XML.

The binary encoded format is more efficient than gzip for small messages, but for process states it's recommended to always use gzip encoding.

After you have amended the process state, you need to retry the process by using the following call:


This will switch the process to the pending state on its processor.

Last edited Apr 19, 2013 at 5:42 PM by dbratus, version 1


No comments yet.