{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/emitter/voltdb-procedure",
  "title" : "Voltdb-procedure Emitter Configuration",
  "description" : "The emitter `voltdb-procedure` invokes VoltDB stored procedure. It employs at-least-once delivery guarantees.\n\nFor each event it will synchronously or asynchronously invoke stored procedure passing event data as arguments. When using\nthe Java API the argument to the sink is a `VoltRequest` object that contains:\n - parameters: an array of `Object`-s that correspond to stored procedure arguments. For example, to invoke a\n  stored procedure that has `public long run(long id, int anotherId, String someString)` the `Object[]` should\n  contain `Long`, `Integer` and `String` or compatible types as defined in the VoltDB\n  [documentation](https://docs.voltactivedata.com/UsingVoltDB/AppxDatatype.php).\n- procedureName: name of the stored procedure to run for this specific event.\n\nIn case of downstream system error this processor will retry procedure execution with exponential backoff.\nThe details of this behaviour are configurable using retry configuration that is nested within client\nconfiguration.\n\nThe `voltdb-procedure` operator requires VoltDBResource to be configured either in yaml or in java, see examples.\n",
  "type" : "object",
  "properties" : {
    "voltdb-procedure" : {
      "type" : "object",
      "properties" : {
        "requestMapper" : {
          "type" : "string",
          "description" : "Maps the input event to a VoltProcedureRequest.\n\nJava:\n  .withRequestMapper(order -> VoltProcedureRequest.createWithParameters(\n          \"InsertOrder\", order.id(), order.amount()))\n\nYAML — the JS function may return a plain JS object matching VoltProcedureRequest's shape:\n  requestMapper: |\n    function process(order) {\n      return { procedureName: \"InsertOrder\", parameters: [order.id, order.amount] };\n    }\n\nIf omitted, a default mapper accepts either a VoltProcedureRequest directly\nor a Map with 'procedureName' and 'parameters' entries."
        },
        "computeFunction" : {
          "type" : "string",
          "description" : "The function computes result event for next operator in pipeline"
        },
        "asyncCall" : {
          "type" : "boolean",
          "description" : "Synchronously/asynchronously call to VoltDB. By default procedures are executed asynchronously.",
          "default" : "true"
        },
        "voltClientResource" : {
          "description" : "Client resource reference to be used when connecting to VoltDb cluster",
          "anyOf" : [ {
            "type" : "string"
          }, {
            "$ref" : "resource-voltdb-client.schema.json#/properties/voltdb-client"
          } ]
        },
        "exceptionHandler" : {
          "type" : "string",
          "description" : "A custom exception handler enabling interception of all errors related to this processor."
        },
        "triggers" : {
          "type" : "array",
          "description" : "List of trigger configurations that create sub-pipelines",
          "items" : {
            "type" : "object",
            "properties" : {
              "trigger" : {
                "type" : "string",
                "enum" : [ "org.voltdb.stream.api.pipeline.emitter.ExceptionTrigger#onError", "org.voltdb.stream.plugin.volt.api.VoltProcedureTrigger#onEachResponse" ],
                "description" : "The trigger point that activates this sub-pipeline"
              },
              "processors" : {
                "type" : "array",
                "description" : "Optional list of processors to apply before the sink or emitter",
                "items" : {
                  "$ref" : "#/$defs/processor"
                }
              },
              "sink" : {
                "$ref" : "#/$defs/sink"
              },
              "emitter" : {
                "$ref" : "#/$defs/emitter"
              }
            },
            "oneOf" : [ {
              "required" : [ "trigger", "sink" ]
            }, {
              "required" : [ "trigger", "emitter" ]
            } ]
          }
        }
      },
      "required" : [ "computeFunction", "voltClientResource", "triggers" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "voltdb-procedure" ],
  "additionalProperties" : false
}
