2.9.3 Register a Kafka Cluster

Before data can be read from a Kafka topic using Oracle SQL access to Kafka (OSaK), the cluster must be registered and assigned a unique name.

A PL/SQL package, or ORA_KAFKA, is installed in a user schema as part of the installation and configuration process. This package contains procedures to register and drop a Kafka cluster, create and drop views for reading data from Kafka topics, manage offsets for each partition of a Kafka topic, and load an Oracle table with data from a Kafka topic.

Also during installation and configuration, the cluster configuration, location, and default directories are created on the operating system. The associated database directory objects are also created: <cluster>_CONF_DIR, <user>_KAFKA_LOC_DIR, and <user>_KAFKA_DEF_DIR. These directories are required input for the ORA_KAFKA.REGISTER_CLUSTER procedure which is described next.

The following example registers the cluster ‘MA1’:

SQL> execute ORA_KAFKA.REGISTER_CLUSTER
  ('MA1',                     -- The name of the cluster
   ‘<bootstrapservers>’,       -- The bootstrap servers for the Kafka cluster  
   '<user>_KAFKA_DEF_DIR',    -- The Oracle default directory for External Tables
   '<user>_KAFKA_LOC_DIR',    -- The Oracle location file directory for External Tables
   'MA1_CONF_DIR',            -- The configuration directory for the Kafka cluster
   'Testing DBMS_KAFKA');     -- A text description of the cluster