3.9.12 Reconfigure Existing Kafka Views
It is possible for additional Kafka partitions to be added to a topic that
is being processed by Oracle SQL access to Kafka (OSaK) views. OSaK provides a procedure
similar to ORA_KAFKA.CREATE_VIEWS
to add additional Kafka partitions to an
existing set of OSaK views.
The ORA_KAFKA.ADD_PARTITIONS
procedure preserves the state
information about existing Kafka topic partitions and binds new partitions to either
existing or new views.
The following example calls the ORA_KAFKA.ADD_PARTITIONS
procedure to add any new Kafka partitions to the views already created for the 'MA1'
cluster:
DECLARE
views_created INTEGER;
application_id VARCHAR2(128);
BEGIN
ORA_KAFKA.ADD_PARTITIONS
('MA1', -- The name of the cluster (specified in ORA_KAFKA.REGISTER_CLUSTER)
'QUERYAPP', -- The name given by the user for a set of views, corresponds to the concept of a Kafka group
'sensor', -- The name of the Kafka topic
views_created); -- Output: number of views created. -1 is returned if there are no additional partitions
-- since the views were created or since the last call to ORA_KAFKA.ADD_PARTITIONS
dbms_output.put_line(‘views created = ‘ || views_created);
END;
/