<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replicate Kafka messages ordering guarantees in Qlik Replicate</title>
    <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474189#M12252</link>
    <description>&lt;P&gt;Hello Tomasz,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/308080"&gt;@Xardas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Welcome to Qlik Community forum and thanks for reaching out here!&lt;/P&gt;
&lt;P&gt;Kafka is one of the endpoints that only allows "Transactional apply", meaning it applies each transaction in the order it is committed.&amp;nbsp;Here is a detailed explanation, specially when multiple topics/partitions are involved: &lt;A title="Kafka overview" href="https://help.qlik.com/en-US/replicate/May2024/Content/Replicate/Main/Kafka/Overview.htm" target="_blank" rel="noopener"&gt;Kafka overview&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Having said that, Replicate is able to implement what is called an "idempotent producer", meaning that there is a way to ensure that messages are always delivered successfully, they are delivered in the right order and they are delivered without duplicates. &lt;BR /&gt;It is important to take into consideration that the right order applies to messages going to the same partition. If messages go to different partitions (because of the settings TOPIC/KEY/PARTITION) then the order among different partitions does not make sense.&lt;/P&gt;
&lt;P&gt;Because of the nature of Kafka (being a messaging endpoint), specific configuration must be used in order to guarantee that messages are always delivered successfully, &lt;FONT face="courier new,courier"&gt;enable.idempotence=true&lt;/FONT&gt; is necessary.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;BR /&gt;John.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 14:30:28 GMT</pubDate>
    <dc:creator>john_wang</dc:creator>
    <dc:date>2024-08-01T14:30:28Z</dc:date>
    <item>
      <title>Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474136#M12249</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I have a question about Replicate Kafka default messages ordering guarantees. It seems that by default Replicate uses at least once kafka semantics &lt;A href="https://community.qlik.com/t5/Official-Support-Articles/Kafka-Does-Replicate-guarantee-that-a-message-is-delivered-only/ta-p/1712092" target="_blank"&gt;https://community.qlik.com/t5/Official-Support-Articles/Kafka-Does-Replicate-guarantee-that-a-message-is-delivered-only/ta-p/1712092&lt;/A&gt;. If I understand correctly this means that for record V the following sequence may appear in a given kafka topic partition (assume we are using partition by key):&lt;/P&gt;
&lt;P&gt;1.V+1&lt;/P&gt;
&lt;P&gt;2.V&lt;/P&gt;
&lt;P&gt;3.V+1&lt;/P&gt;
&lt;P&gt;In this case, even though the duplicate (V+1) is present, the latest by offset value (V+1) is "correct" - it is the current state of this record. Now my question is, after the replication is completed (all the transactions have been processed), could also the following sequence be observed in a given topic partition while using default Replicate settings&lt;/P&gt;
&lt;P&gt;1.V+1&lt;/P&gt;
&lt;P&gt;2.V?&lt;/P&gt;
&lt;P&gt;Here all the records have been successfuly sent to kafka, but in the wrong order (batching?) - the latest by offset value doesn't represent the latest state of the record, contrary to the previous example with a duplicate.&lt;/P&gt;
&lt;P&gt;I also wonder, if to make sure that the latest by offset value is always "correct" (when the processing is completed), the Replicate user must configure an idempotent Kafka producer (enable.idempotence = true).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Tomasz&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 10:45:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474136#M12249</guid>
      <dc:creator>Xardas</dc:creator>
      <dc:date>2024-08-01T10:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474189#M12252</link>
      <description>&lt;P&gt;Hello Tomasz,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/308080"&gt;@Xardas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Welcome to Qlik Community forum and thanks for reaching out here!&lt;/P&gt;
&lt;P&gt;Kafka is one of the endpoints that only allows "Transactional apply", meaning it applies each transaction in the order it is committed.&amp;nbsp;Here is a detailed explanation, specially when multiple topics/partitions are involved: &lt;A title="Kafka overview" href="https://help.qlik.com/en-US/replicate/May2024/Content/Replicate/Main/Kafka/Overview.htm" target="_blank" rel="noopener"&gt;Kafka overview&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Having said that, Replicate is able to implement what is called an "idempotent producer", meaning that there is a way to ensure that messages are always delivered successfully, they are delivered in the right order and they are delivered without duplicates. &lt;BR /&gt;It is important to take into consideration that the right order applies to messages going to the same partition. If messages go to different partitions (because of the settings TOPIC/KEY/PARTITION) then the order among different partitions does not make sense.&lt;/P&gt;
&lt;P&gt;Because of the nature of Kafka (being a messaging endpoint), specific configuration must be used in order to guarantee that messages are always delivered successfully, &lt;FONT face="courier new,courier"&gt;enable.idempotence=true&lt;/FONT&gt; is necessary.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;BR /&gt;John.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 14:30:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474189#M12252</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2024-08-01T14:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474280#M12254</link>
      <description>&lt;P&gt;Hello John,&lt;/P&gt;
&lt;P&gt;Thanks for your quick reply!&lt;/P&gt;
&lt;P&gt;Just to make sure I got this right - in other words Replicate itself creates the messages that are going to be send to Kafka in the right order. However to actually send them to Kafka, librdkafka is being used and it must be configured properly (enable.idempotence=true) to ensure the messages also always arrive in the right order (within the same partition). Correct?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Tomasz&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 07:35:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474280#M12254</guid>
      <dc:creator>Xardas</dc:creator>
      <dc:date>2024-08-02T07:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474285#M12255</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/308080"&gt;@Xardas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;This is correct.&lt;/P&gt;
&lt;P&gt;We may get below line from task log file if the target apply set to Batch Apply Mode:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;2024-08-02T15:08:41:138406 [TASK_MANAGER ]I: The "Batch optimized apply" option is not available when Kafka is the target endpoint. The "Transactional apply" option will be used instead.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So whatever the apply mode is set to, Qlik Replicate will work under&amp;nbsp;&lt;FONT face="courier new,courier"&gt;"Transactional apply" option&lt;/FONT&gt;&amp;nbsp;always.&lt;/P&gt;
&lt;P&gt;The recommended internal parameters are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rdkafkaProperties = "enable.idempotence=true;acks=all;max.in.fff.requests.per.connection=1"
rdkafkaTopicProperties = "acks=all"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note replace "fff" by:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="john_wang_0-1722588530334.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/170150i257E673D36913EA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="john_wang_0-1722588530334.png" alt="john_wang_0-1722588530334.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 08:49:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474285#M12255</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2024-08-02T08:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474302#M12256</link>
      <description>&lt;P&gt;Perfect, thanks a lot for explaining!&lt;/P&gt;
&lt;P&gt;However I'm a bit puzzled about the rest of the recommended internal parameters you mentioned.&lt;/P&gt;
&lt;P&gt;librdkafka documentation states that &lt;EM&gt;enable.idempotence = true&lt;/EM&gt; alone is enough to ensure that messages are produced exactly once and in the original producer order. The rest of the parameters will be adjusted automatically (unless modified by the user).&lt;/P&gt;
&lt;P&gt;(&lt;A href="https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md" target="_blank" rel="noopener"&gt;https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md):&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;"When set to &lt;CODE&gt;true&lt;/CODE&gt;, the producer will ensure that messages are successfully produced exactly once and in the original produce order. The following configuration properties are adjusted automatically (if not modified by the user) when idempotence is enabled: &lt;CODE&gt;max.in.(...).requests.per.connection=5&lt;/CODE&gt; (&lt;STRONG&gt;must be less than or equal to 5&lt;/STRONG&gt;), &lt;CODE&gt;retries=INT32_MAX&lt;/CODE&gt; (must be greater than 0), &lt;CODE&gt;acks=all&lt;/CODE&gt;, &lt;CODE&gt;queuing.strategy=fifo&lt;/CODE&gt;."&lt;/P&gt;
&lt;P&gt;I'm puzzled why it is recommended to limit&lt;EM&gt; max.in.fff.requests.per.connection&lt;/EM&gt; to 1 instead of using the default (when already using &lt;EM&gt;enable.idempotence = true&lt;/EM&gt;) 5? Based on librdkafka docs it seems that Kafka ordering guarantees would be kept as long as this param is &amp;lt;=5 (when using &lt;EM&gt;enable.idempotence = true&lt;/EM&gt;). I guess reducing it to 1 could be an unnecessary performance hit.&lt;/P&gt;
&lt;P&gt;Also, I believe setting &lt;EM&gt;acks=all&lt;/EM&gt; would be done automatically when using &lt;EM&gt;enable.idempotence = true&lt;/EM&gt; (it is not necessary to set it explicitly).&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Tomasz&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 10:57:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474302#M12256</guid>
      <dc:creator>Xardas</dc:creator>
      <dc:date>2024-08-02T10:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474351#M12264</link>
      <description>&lt;P&gt;Hello Tomasz,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/308080"&gt;@Xardas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the update.&lt;/P&gt;
&lt;P&gt;From Kafka docs, yes, you are right. However if you only set &lt;FONT face="courier new,courier"&gt;&lt;EM&gt;enable.idempotence = true&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;and leave other properties default values, you might get below error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;2024-08-02T21:20:27:324266 [TARGET_APPLY ]E: Failed to create Kafka handle: `acks` must be set to `all` when `enable.idempotence` is true. [1020401] (kafka_client.c:874)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;It's same in all Qlik Replicate major versions, that's why I suggest you setting them even the default value is "all"/"-1".&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 13:25:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474351#M12264</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2024-08-02T13:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474485#M12268</link>
      <description>&lt;P&gt;Interesting, so &lt;EM&gt;acks=all&lt;/EM&gt;, must be set explicitely, thanks!&lt;/P&gt;
&lt;P&gt;What about&lt;EM&gt; max.in.fff.requests.per.connection,&lt;/EM&gt; why is it recommended to limit it to 1, instead of using the default value (5) for the idempotent producer?&lt;/P&gt;
&lt;P&gt;For reference, it seems that this issue &lt;A href="https://issues.apache.org/jira/browse/KAFKA-5494" target="_blank"&gt;https://issues.apache.org/jira/browse/KAFKA-5494&lt;/A&gt; explains how Kafka preserves the ordering guaratees (when idempotence is enabled) even with 5&amp;gt;=&lt;EM&gt;max.in.fff.requests.per.connection&lt;/EM&gt; &amp;gt; 1.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Tomasz&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 06:54:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474485#M12268</guid>
      <dc:creator>Xardas</dc:creator>
      <dc:date>2024-08-05T06:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Kafka messages ordering guarantees</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474680#M12272</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/308080"&gt;@Xardas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thanks for the sharing, this is a very helpful information. I'd like to suggest you opening a support ticket, we will confirm with CF/R&amp;amp;D team for you.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 03:00:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Replicate-Kafka-messages-ordering-guarantees/m-p/2474680#M12272</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2024-08-06T03:00:31Z</dc:date>
    </item>
  </channel>
</rss>

