Write Data

This handler (com.rierino.handler.WriteEventHandler) provides ability to create, update, delete records on a state manager on demand, facilitating common REST API write calls.

Handler Parameters

Parameter
Definition
Example
Default

useDiff

Whether handler should generate journals keeping only actual updates from current data by default (i.e. removing fields which are same as current data)

true

false

Example Write Handler Definition (Can be Imported on Element Screen)

Actions

Most actions of this handler utilize the following event metadata fields:

Field
Definition
Example
Default

domain

Name of the state manager to read data from

product

-

inputElement

Json path for the input in request event payload

parameters

-

outputElement

Json path for the output in response event payload

$.product

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESPath pattern to apply on data input

{id:parameters.id, data:parameters.data}

-

outputPattern

JMESPath pattern to apply on data output, before returning response

{id:id, name:data.name, description:data.description}

-

useDiff

Whether handler should generate journals keeping only actual updates from current data for the event

true

false

ifPattern

JMES path pattern evaluating condition on current data to decide whether to execute update

data.status == 'A'

-

failStale

Whether to fail in case a request with old instance version or offset arrives

false

true

returnResult

Whether the action should return updated data after the change

false

true

immediate

Whether the action should be executed immediately, or can be buffered for bulk execution

false

true

keepImpact

Whether the action should also return the impact created on current record

true

false

keepUndo

Whether the action should also return the undo action required to revert the impact

true

false

structure

Type of input to apply updates for (i.e. or = [{id, data}, {id, data}], = [ids: [id, id], data: {}], single = {id, data})

array

single

dataPath

Json path for the data to use in update, when form is "multi"

newData

data

idsPath

Json path for the ids to update, when form is "multi"

productids

ids

itemPath

Json path for the array field to update (for SetElement and RemoveElement)

parameters

-

allowManualId

When creating a new record, whether IDs can be given manually, if there is already an ID generator

true

false

Example

Input

{
    "parameters": {
        "id": "given-id",
        "data":{
            "name": "Test",
            "description": "Test Entry"
        }
    }
}

Event Metadata

Create

Creates a new aggregate on a specific state manager.

Update

Patches an existing aggregate on a specific state manager.

Set

Completely updates an existing aggregate on a specific state manager.

Upsert

Completely updates or creates an aggregate on a specific state manager.

Delete

Marks an aggregate as deleted, hiding it on a specific state manager.

Undelete

Unmarks an aggregate as deleted, making it accessible again on a specific state manager.

Remove

Completely removes an aggregate from a specific state manager.

SetElement

Adds to or sets element of an array field of an aggregate on a specific state manager.

RemoveElement

Removes element of an array field of an aggregate on a specific state manager.

Last updated