Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

Add Splitter type #5

@antoineco

Description

@antoineco

A splitter (sometimes called "sequencer")

  1. Takes a payload composed of multiple individual elements
  2. Generates a single CloudEvent for each of these element

Scope:

  • Only JSON input
  • Only supports arrays of data objects which satisfy the same schema

Out of scope:

  • Delivery guarantees

EIP reference: https://www.enterpriseintegrationpatterns.com/patterns/messaging/Sequencer.html


Example spec (non final):

path:
  type: string
  description: JSONPath expression representing the key containing the data array to split. Defaults to the root.

ce_context:
  type: object
  description: Context attributes to set on produced CloudEvents.
  properties:
    type:
      type: string
      description: CloudEvent "type" context attribute.
    source:
      description: CloudEvent "source" context attribute. Accepts a JSONPath expressions in brackets (e.g. "user/{.name}").
    extensions:
      type: object
      description: Additional context extensions to set on produced CloudEvents.
      additionalProperties:
        type: string

Example input:

[
    {
        "user": {
            "id": 0,
            "name": "Seb"
        }
    },
    {
        "user": {
            "id": 1,
            "name": "Timur"
        }
    },
    {
        "user": {
            "id": 2,
            "name": "Pablo"
        }
    }
]

Example output:

☁️  cloudevents.Event
Validation: valid
Context Attributes,
  specversion: 1.0
  type: triggermesh.user
  source: http://example.auth0.com
  id: 2159325315057508-0
  time: 2021-04-10T00:57:23.68Z
  datacontenttype: application/json
Extensions,
  origin: my_user_management
Data,
  {
      "user": {
          "id": 0,
          "name": "Seb"
      }
  }

☁️  cloudevents.Event
Validation: valid
Context Attributes,
  specversion: 1.0
  type: triggermesh.user
  source: http://example.auth0.com
  id: 2159325315057508-1
  time: 2021-04-10T00:57:23.68Z
  datacontenttype: application/json
Extensions,
  origin: my_user_management
Data,
  {
      "user": {
          "id": 1,
          "name": "Pablo"
      }
  }

☁️  cloudevents.Event
Validation: valid
Context Attributes,
  specversion: 1.0
  type: triggermesh.user
  source: http://example.auth0.com
  id: 2159325315057508-2
  time: 2021-04-10T00:57:23.68Z
  datacontenttype: application/json
Extensions,
  origin: my_user_management
Data,
  {
      "user": {
          "id": 2,
          "name": "Timur"
      }
  }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions