{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/sink/pulsar",
  "title" : "Pulsar Sink Configuration",
  "description" : "The `pulsar` sink sends data to an Apache Pulsar topic. It supports a variety of configurations such as specifying\n the topic name, service URL, authentication, SSL configuration, and more.\n This sink is ideal for integrating with Pulsar for real-time data streaming.\n",
  "type" : "object",
  "properties" : {
    "pulsar" : {
      "type" : "object",
      "properties" : {
        "serviceUrl" : {
          "type" : "string",
          "description" : "The service URL for connecting to the Pulsar cluster.\nFor example: pulsar://localhost:6650 or pulsar+ssl://pulsar.example.com:6651"
        },
        "topicName" : {
          "type" : "string",
          "description" : "Sets the Pulsar topic name where data will be sent."
        },
        "producerName" : {
          "type" : "string",
          "description" : "Optional producer name for identification purposes."
        },
        "properties" : {
          "type" : "object",
          "description" : "Adds or overrides specific Pulsar client properties, allowing customization for advanced configurations.",
          "additionalProperties" : {
            "type" : "string"
          }
        },
        "ssl" : {
          "type" : "object",
          "description" : "SSL configuration.",
          "properties" : {
            "trustStoreFile" : {
              "type" : "string",
              "description" : "Truststore file or trusted CA certificate; supported formats include JKS, PKCS#12, or PEM."
            },
            "trustStorePassword" : {
              "type" : "string",
              "description" : "Truststore password."
            },
            "keyStoreFile" : {
              "type" : "string",
              "description" : "Keystore file; supported formats include JKS, PKCS#12, or PEM"
            },
            "keyStorePassword" : {
              "type" : "string",
              "description" : "Keystore password."
            },
            "keyPassword" : {
              "type" : "string",
              "description" : "Private key password. Optional — if not set, the key store password will be used."
            },
            "insecure" : {
              "type" : "boolean",
              "description" : "If set to true, disables SSL certificate and hostname validation.\nIntended for debugging purposes only. Doesn't work with mTLS.\n"
            },
            "hostnameVerifier" : {
              "type" : "string",
              "description" : "Custom hostname verifier for SSL connections.\nIf not specified and 'insecure' is true, hostname verification will be disabled.\n"
            }
          },
          "additionalProperties" : false
        },
        "authToken" : {
          "type" : "string",
          "description" : "Authentication token for Pulsar authentication."
        },
        "exceptionHandler" : {
          "type" : "string",
          "description" : "Custom exception handler enabling interception of all errors related to this sink."
        },
        "keyExtractor" : {
          "type" : "string",
          "description" : "A function that extracts the message key from the given output object.\nThe extracted key is used by Pulsar for message ordering within a topic."
        },
        "valueExtractor" : {
          "type" : "string",
          "description" : "A function that extracts the message value (payload) from the output object.\nThis is the core content of the Pulsar message."
        },
        "propertiesExtractor" : {
          "type" : "string",
          "description" : "A function that extracts message properties from the output object.\nProperties can carry metadata or additional context alongside the message."
        },
        "batchingMaxMessages" : {
          "type" : "integer",
          "description" : "Maximum number of messages to batch before sending.\nBatching improves throughput by sending multiple messages in a single request.",
          "default" : "1000",
          "minimum" : -2147483648,
          "maximum" : 2147483647
        },
        "batchingMaxPublishDelay" : {
          "type" : "string",
          "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
          "description" : "Maximum time to wait before sending a batch of messages.\nEven if the batch is not full, messages will be sent after this delay.",
          "default" : "10ms"
        },
        "compressionType" : {
          "type" : "string",
          "description" : "Compression type for messages sent to Pulsar.\nCompression reduces network bandwidth and storage requirements.",
          "default" : "NONE",
          "enum" : [ "none", "lz4", "zlib", "zstd", "snappy", "NONE", "LZ4", "ZLIB", "ZSTD", "SNAPPY" ]
        },
        "sendTimeout" : {
          "type" : "string",
          "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
          "description" : "Timeout for sending messages to Pulsar.\nIf a message cannot be sent within this time, it will fail.",
          "default" : "30s"
        },
        "messageRoutingMode" : {
          "type" : "string",
          "description" : "Message routing mode for partitioned topics.\nDetermines how messages are distributed across partitions.",
          "default" : "ROUND_ROBIN_PARTITION",
          "enum" : [ "single_partition", "round_robin_partition", "custom_partition", "SINGLE_PARTITION", "ROUND_ROBIN_PARTITION", "CUSTOM_PARTITION" ]
        }
      },
      "required" : [ "serviceUrl", "topicName" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "pulsar" ],
  "additionalProperties" : false
}
