Detacher
Description
This unit is a Processor unit type.
A unit that transforms an event containing a list into a sequence of events containing successive list items. This can be done simultaneously over several lists (producing a zip, not a cartesian product).
You specify fields in the input event containing lists to be detached and transformed into individual values in the output events.
An event comes in through the in port. The init port emits a signal stream to indicate the start of a list.
The unit processes and transforms the lists into individual values. The end port emits a signal stream to indicate the end of a list.
If some of the specified fields are not present or don't have the correct type, the event is sent to the malformed output port.
Successful N output events are sent to the out port, N being the max length of lists. Each of these events will contain "a slice" of original lists at a growing index. For lists shorter than the longest one, corresponding values will be null.
Configuration
After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:
Tab | Field | Description | |
---|---|---|---|
General | Name | Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed. | |
Description | Enter a description detailing the scope of the unit. | ||
Fields | Click the plus icon to add fields containing lists. You can collapse and expand the fields using the icon, reorder using the arrows, or delete using the X icon. You can also reorder the fields using drag and drop. | ||
Name | Enter the name of the field in the input event containing a list. | ||
Array | Whether collection type is Array (true) or Collection (false). | ||
Component type | Class of collection/array items. Enter a java class qualified name. |
Input ports
Port | Description |
---|---|
in | All events enter through this port. They must contain fields specified in settings, and comply with the specified type. |
Output ports
Port | Description |
---|---|
init | Signal stream that indicates the start of a list. |
out | Outputs the events containing the same fields as input events, but with single values instead of lists. |
end | Signal stream that indicates the end of a list. |
malformed | Outputs input events that don't have the specified fields or type. |
Example
Imagine you wish to send a list of users as separate events to a Devo data table.
You can use the Generator unit to emit the desired number of events from across Devo.
Then, we link it to the in port of a Map unit containing a string of values detailing user names.
You must add a blank value in the Expression field to separate the values.
 Next, link a Detacher unit from the out port of the Map unit. In the Detacher properties, specify the field containing the list in the Map unit, in this case Key, and the component type as String.
Finally, we link it to the in input port of a Devo sink unit to send it to the required my.app table.
Download this example
You can try this flow by downloading the following JSON file and uploading it to your domain using the Import option:
Â