{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/sink/voltdb-procedure",
  "title" : "Voltdb-procedure Sink Configuration",
  "description" : "The `voltdb-procedure` sink passes data to a VoltDB stored procedure. It employs at-least-once delivery guarantees.\n\nFor each event it will asynchronously invoke a 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 sink 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" : {
        "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"
          } ]
        },
        "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."
        },
        "exceptionHandler" : {
          "type" : "string",
          "description" : "A custom exception handler to process errors that occur during procedure execution."
        }
      },
      "required" : [ "voltClientResource" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "voltdb-procedure" ],
  "additionalProperties" : false
}
