Implode mode

Reassemble a previously exploded array into a single event.

For a demo of explode and implode in use in a story see here.

Features 

  • Collect individual events which have been emitted as part of an explode and store them in memory. When either all of, a specified number of, or after waiting a specified amount of time, the exploded events that have been collected will be emitted in a single event.

  • Specify the data from incoming individual events to collect into the single event emitted by the current action.

  • Specify a GUID to collect only related events together - usually the GUID emitted in events as part of an explode operation.

  • Specify the number of events that the implode should collect - usually the size of an exploded array.

  • Specify the amount of time that implode should collect events for before emitting an event.

Configuration Options 

  • mode: 'implode'

  • item_path: The path to items to collect into an array in the output event.

  • guid_path: The unique GUID used to identify exploded events.

  • size_path: The number of events implode should collect before emitting an event.

  • seconds: The number of seconds to wait after implode receives the first event before emitting an event. This can also be used in conjunction with size_path, resulting in an event being emitted as soon as either the size_path or seconds requirement is reached.

Emitted Events 

{
  "implode": [
    {
      "receive_webhook": {
        "numbers": [1, 2, 3]
      },
      "explode_array": {
        "guid": "8bc687b5-764f-492e-9210-21ac502ffa98",
        "index": 0,
        "size": 3,
        "number": 1
      }
    },
    {
      "receive_webhook": {
        "numbers": [1, 2, 3]
      },
      "explode_array": {
        "guid": "8bc687b5-764f-492e-9210-21ac502ffa98",
        "index": 1,
        "size": 3,
        "number": 2
      }
    },
    {
      "receive_webhook": {
        "numbers": [1, 2, 3]
      },
      "explode_array": {
        "guid": "8bc687b5-764f-492e-9210-21ac502ffa98",
        "index": 2,
        "size": 3,
        "number": 3
      }
    }
  ]
}

Example Configuration Options 

Reassemble an array of 'exploded' URLs from a previous action in the story:

{
  "mode": "implode",
  "item_path": "<<transform_url.new_url>>",
  "guid_path": "<<explode_urls.guid>>",
  "size_path": "<<explode_urls.size>>"
}

Reassemble split events from branches of a story which were running asynchronous:

{
  "mode": "implode",
  "guid_path": "<<STORY_RUN_GUID()>>",
  "size_path": "3"
}

Consolidate API paging requests into a single event by setting the size to the number of pages available:

{
  "mode": "implode",
  "item_path": "<<get_all_actions.body.results>>",
  "guid_path": "<<STORY_RUN_GUID()>>",
  "size_path": "<<get_all_actions.body.meta.pages>>"
}

Consolidate API paging requests into a single event after waiting five minutes:


{
  "mode": "implode",
  "item_path": "<<get_all_actions.body.results>>",
  "guid_path": "<<STORY_RUN_GUID()>>",
  "seconds": 300
}
Was this helpful?