<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Producing Kafka messages using notifiers</title>
    <link>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/</link>
    <description>Recent content in Producing Kafka messages using notifiers on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Kafka-Integration: Creating a Kafka notifier</title>
      <link>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/creating-kafka-notifier/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/creating-kafka-notifier/</guid>
      <description>
        
        
        &lt;p&gt;The following procedure creates a Kafka notifier. At a minimum, a notifier defines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A unique name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A message protocol. This is &lt;code&gt;kafka://&lt;/code&gt; when sending messages to Kafka.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The server to communicate with. For Kafka, this is the address and port number of a Kafka broker.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The maximum message buffer size. If the queue of messages to be sent via the notifier exceed this limit, messages are dropped.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You create the notifier with &lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-notifier/#&#34;&gt;CREATE NOTIFIER&lt;/a&gt;. This example creates a notifier named &lt;code&gt;load_progress_notifier&lt;/code&gt; that sends messages via the Kafka broker running on kafka01.example.com on port 9092:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE NOTIFIER load_progress_notifier
    ACTION &amp;#39;kafka://kafka01.example.com:9092&amp;#39;
    MAXMEMORYSIZE &amp;#39;10M&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;While not required, it is best practice to create notifiers that use an encrypted connection. The following example creates a notifier that uses an encrypted connection and verifies the Kafka server&#39;s certificate with the provided &lt;a href=&#34;../../../../en/security-and-authentication/tls-protocol/tls-overview/tls-configs/#&#34;&gt;TLS configurations&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE NOTIFIER encrypted_notifier
    ACTION &amp;#39;kafka://127.0.0.1:9092&amp;#39;
    MAXMEMORYSIZE &amp;#39;10M&amp;#39;
    TLS CONFIGURATION &amp;#39;notifier_tls_config&amp;#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Follow this procedure to create or alter notifiers for Kafka endpoints that use SASL_SSL. Note that you must repeat this procedure whenever you change the TLSMODE, certificates, or CA bundle for a given notifier.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-tls-config/&#34;&gt;Create a TLS Configuration&lt;/a&gt; with the desired TLS mode, certificate, and CA certificates.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use CREATE or ALTER to disable the notifier and set the TLS Configuration:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER NOTIFIER encrypted_notifier
    DISABLE
    TLS CONFIGURATION kafka_tls_config;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER the notifier and set the proper rdkafka adapter parameters for SASL_SSL:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER NOTIFIER encrypted_notifier PARAMETERS
    &amp;#39;sasl.username=user;sasl.password=password;sasl.mechanism=PLAIN;security.protocol=SASL_SSL&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable the notifier:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER NOTIFIER encrypted_notifier ENABLE;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;


      </description>
    </item>
    
    <item>
      <title>Kafka-Integration: Sending individual messages via a Kafka notifier</title>
      <link>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/sending-individual-messages-via-kafka-notifier/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/sending-individual-messages-via-kafka-notifier/</guid>
      <description>
        
        
        &lt;p&gt;You can send an individual message via a Kafka notifier using the &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/notifier-functions/notify/#&#34;&gt;NOTIFY&lt;/a&gt; function. This feature is useful for reporting the progress of SQL scripts such as ETL tasks to third-party reporting tools.&lt;/p&gt;
&lt;p&gt;You pass this function three string values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The message to send.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The name of the notifier to send the message.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Kafka topic to receive the message.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, if you want to send the message &amp;quot;Daily load finished&amp;quot; to the vertica_notifications topic of the Kafka cluster defined in the load_progress_notifier notifier created earlier. Then you could execute the following statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT NOTIFY(&amp;#39;Daily load finished.&amp;#39;,
                 &amp;#39;load_progress_notifier&amp;#39;,
                 &amp;#39;vertica_notifications&amp;#39;);
 NOTIFY
--------
 OK
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The message the notifier sends to Kafka is in JSON format. You can see the resulting message by using the console consumer on a Kafka node. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 \
                                           --from-beginning \
                                           --topic vertica_notifications \
                                           --max-messages 1

{&amp;#34;_db&amp;#34;:&amp;#34;vmart&amp;#34;,&amp;#34;_schema&amp;#34;:&amp;#34;v_internal&amp;#34;,&amp;#34;_table&amp;#34;:&amp;#34;dc_notifications&amp;#34;,
&amp;#34;channel&amp;#34;:&amp;#34;vertica_notifications&amp;#34;,&amp;#34;message&amp;#34;:&amp;#34;Daily load finished.&amp;#34;,
&amp;#34;node_name&amp;#34;:&amp;#34;v_vmart_node0001&amp;#34;,&amp;#34;notifier&amp;#34;:&amp;#34;load_progress_notifier&amp;#34;,
&amp;#34;request_id&amp;#34;:2,&amp;#34;session_id&amp;#34;:&amp;#34;v_vmart_node0001-463079:0x4ba6f&amp;#34;,
&amp;#34;statement_id&amp;#34;:-1,&amp;#34;time&amp;#34;:&amp;#34;2018-06-19 09:48:42.314181-04&amp;#34;,
&amp;#34;transaction_id&amp;#34;:45035996275565458,&amp;#34;user_id&amp;#34;:45035996273704962,
&amp;#34;user_name&amp;#34;:&amp;#34;dbadmin&amp;#34;}

Processed a total of 1 messages
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Kafka-Integration: Monitoring DC tables with Kafka notifiers</title>
      <link>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/monitoring-dc-tables-with-kafka-notifiers/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/monitoring-dc-tables-with-kafka-notifiers/</guid>
      <description>
        
        
        &lt;p&gt;OpenText™ Analytics Database &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/data-collector/&#34; title=&#34;A utility that collects and retains database monitoring information.&#34;&gt;Data collector&lt;/a&gt; (DC) tables monitor many different database functions. You can have a &lt;a href=&#34;../../../../en/kafka-integration/producing-data-kafka/producing-kafka-messages-using-notifiers/creating-kafka-notifier/&#34;&gt;notifier&lt;/a&gt; automatically send a message to a Kafka endpoint when a DC component updates. You can query the &lt;a href=&#34;../../../../en/sql-reference/system-tables/v-monitor-schema/data-collector/#&#34;&gt;DATA_COLLECTOR&lt;/a&gt; table to get a list of the DC components.&lt;/p&gt;
&lt;p&gt;You configure the notifier to send DC component updates to Kafka using the function &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/notifier-functions/set-data-collector-notify-policy/#&#34;&gt;SET_DATA_COLLECTOR_NOTIFY_POLICY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To be notified of failed login attempts, you can create a notifier that sends a notification when the DC component &lt;code&gt;LoginFailures&lt;/code&gt; updates. The &lt;code&gt;TLSMODE&lt;/code&gt; &#39;verify-ca&#39; verifies that the server&#39;s certificate is signed by a trusted CA.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE NOTIFIER vertica_stats ACTION &amp;#39;kafka://kafka01.example.com:9092&amp;#39; MAXMEMORYSIZE &amp;#39;10M&amp;#39; TLSMODE &amp;#39;verify-ca&amp;#39;;
CREATE NOTIFIER
=&amp;gt; SELECT SET_DATA_COLLECTOR_NOTIFY_POLICY(&amp;#39;LoginFailures&amp;#39;,&amp;#39;vertica_stats&amp;#39;, &amp;#39;vertica_notifications&amp;#39;, true);
SET_DATA_COLLECTOR_NOTIFY_POLICY
----------------------------------
 SET
(1 row)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Like the messages sent via the NOTIFY function, the data sent to Kafka from the DC components is in JSON format. The previous example results in messages like the following being sent to the vertica_notifications Kafka topic:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{&amp;#34;_db&amp;#34;:&amp;#34;vmart&amp;#34;,&amp;#34;_schema&amp;#34;:&amp;#34;v_internal&amp;#34;,&amp;#34;_table&amp;#34;:&amp;#34;dc_login_failures&amp;#34;,
&amp;#34;authentication_method&amp;#34;:&amp;#34;Reject&amp;#34;,&amp;#34;client_authentication_name&amp;#34;:&amp;#34;&amp;#34;,
&amp;#34;client_hostname&amp;#34;:&amp;#34;::1&amp;#34;,&amp;#34;client_label&amp;#34;:&amp;#34;&amp;#34;,&amp;#34;client_os_user_name&amp;#34;:&amp;#34;dbadmin&amp;#34;,
&amp;#34;client_pid&amp;#34;:481535,&amp;#34;client_version&amp;#34;:&amp;#34;&amp;#34;,&amp;#34;database_name&amp;#34;:&amp;#34;alice&amp;#34;,
&amp;#34;effective_protocol&amp;#34;:&amp;#34;3.8&amp;#34;,&amp;#34;node_name&amp;#34;:&amp;#34;v_vmart_node0001&amp;#34;,
&amp;#34;reason&amp;#34;:&amp;#34;INVALID USER&amp;#34;,&amp;#34;requested_protocol&amp;#34;:&amp;#34;3.8&amp;#34;,&amp;#34;ssl_client_fingerprint&amp;#34;:&amp;#34;&amp;#34;,
&amp;#34;time&amp;#34;:&amp;#34;2018-06-19 14:51:22.437035-04&amp;#34;,&amp;#34;user_name&amp;#34;:&amp;#34;alice&amp;#34;}
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;viewing-notification-policies-for-a-dc-component&#34;&gt;Viewing notification policies for a DC component&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/notifier-functions/get-data-collector-notify-policy/#&#34;&gt;GET_DATA_COLLECTOR_NOTIFY_POLICY&lt;/a&gt; function to list the policies set for a DC component.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT GET_DATA_COLLECTOR_NOTIFY_POLICY(&amp;#39;LoginFailures&amp;#39;);
                   GET_DATA_COLLECTOR_NOTIFY_POLICY
----------------------------------------------------------------------
 Notifiable;  Notifier: vertica_stats; Channel: vertica_notifications
(1 row)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;disabling-a-notification-policy&#34;&gt;Disabling a notification policy&lt;/h2&gt;
&lt;p&gt;You can call &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/notifier-functions/set-data-collector-notify-policy/#&#34;&gt;SET_DATA_COLLECTOR_NOTIFY_POLICY&lt;/a&gt; function with its fourth argument set to FALSE to disable a notification policy. The following example disables the notify policy for the LoginFailures component:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT SET_DATA_COLLECTOR_NOTIFY_POLICY(&amp;#39;LoginFailures&amp;#39;,&amp;#39;vertica_stats&amp;#39;, &amp;#39;vertica_notifications&amp;#39;, false);
 SET_DATA_COLLECTOR_NOTIFY_POLICY
----------------------------------
 SET
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT GET_DATA_COLLECTOR_NOTIFY_POLICY(&amp;#39;LoginFailures&amp;#39;);
 GET_DATA_COLLECTOR_NOTIFY_POLICY
----------------------------------
 Not notifiable;
(1 row)
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
  </channel>
</rss>
