{
  "$id": "adapter-kafka",
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "host": {
          "type": "string",
          "description": "hostname of the server",
          "default": "localhost",
          "examples": [
            "systemx.customer.com"
          ]
        },
        "port": {
          "type": "integer",
          "description": "port on which to connect to the server",
          "default": 9092,
          "minimum": 1,
          "maximum": 65535
        }
      },
      "required": [
        "host",
        "port"
      ]
    },
    {
      "type": "object",
      "properties": {
        "hostList": {
          "type": "string",
          "description": "A string of kafka broker/host combination delimited by comma",
          "default": "localhost:9092",
          "examples": [
            "kafka-1.us-east-1.myapp.com:9093,kafka-2.us-east-1.myapp.com:9093,kafka-3.us-east-1.myapp.com:9093",
            "kafka-1.us-east-1.myapp.com:9093"
          ]
        }
      },
      "required": [
        "hostList"
      ]
    }
  ],
  "if": {
    "not": {
      "anyOf": [
        {
          "required": ["host"]
        },
        {
          "required": ["hostList"]
        }
      ]
    }
  },
  "then": {
    "properties": {
      "host": {
        "default": "localhost"
      },
      "port": {
        "default": 9092
      }
    }
  },
  "properties": {
    "registry_url": {
      "type": "string",
      "description": "registry url of schema",
      "default": "",
      "examples": [
        "systemx.customer.com:8081"
      ]
    },
    "topics": {
      "type": "array",
      "description": "An array of specific topics to move from kafka to rabbit",
      "items": {
        "type": [
          "string",
          "object"
        ]
      }
    },
    "interval_time": {
      "type": "integer",
      "description": "how often to write the topics file",
      "default": 30000,
      "minimum": 5000,
      "maximum": 3600000
    },
    "stub": {
      "type": "boolean",
      "description": "run in stub mode - turns off topic writing",
      "default": false
    },
    "client": {
      "type": "object",
      "properties": {
        "connectTimeout": {
          "type": "integer",
          "default": 10000
        },
        "requestTimeout": {
          "type": "integer",
          "default": 30000
        },
        "autoConnect": {
          "type": "boolean",
          "default": true
        },
        "connectRetryOptions": {
          "type": "object"
        },
        "idleConnection": {
          "type": "integer",
          "default": 300000
        },
        "reconnectOnIdle": {
          "type": "boolean",
          "default": true
        },
        "maxAsyncRequests": {
          "type": "integer",
          "default": 10
        },
        "sslOptions": {
          "type": "object"
        },
        "sasl": {
          "type": "object"
        }
      }
    },
    "producer": {
      "type": "object",
      "properties": {
        "requireAcks": {
          "type": "integer"
        },
        "ackTimeoutMs": {
          "type": "integer"
        },
        "partitionerType": {
          "type": "integer"
        }
      }
    },
    "consumer": {
      "type": "object",
      "properties": {
        "groupId": {
          "type": "string"
        },
        "autoCommit": {
          "type": "boolean"
        },
        "autoCommitIntervalMs": {
          "type": "integer"
        },
        "fetchMaxWaitMs": {
          "type": "integer"
        },
        "fetchMinBytes": {
          "type": "integer"
        },
        "fetchMaxBytes": {
          "type": "integer"
        },
        "fromOffset": {
          "type": "boolean"
        },
        "encoding": {
          "type": "string"
        },
        "keyEncoding": {
          "type": "string"
        }
      }
    }
  },
  "definitions": {}
}