<?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: Kafka - commit offset manually in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325798#M95362</link>
    <description>&lt;P&gt;Your code worked for me.&amp;nbsp; Be sure to set&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;allowManualCommit=true&lt;/EM&gt; in Kafka Properties on the Advanced Settings tab of you cKafka component.&amp;nbsp; Of course, you'll want to uncheck &lt;EM&gt;Auto Commit Enabled&lt;/EM&gt; on Basic Settings of the component.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also found a code snip it in this article that is useful if you use Kafka's ability to grab a batch of message when consuming messages.&amp;nbsp; This snip-it will ensure it only commits if the route is on the last message of the batch.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/51843677/how-to-transactionally-poll-kafka-from-camel/52300250#52300250" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stackoverflow.com/questions/51843677/how-to-transactionally-poll-kafka-from-camel/52300250#52300250&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 13:38:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-21T13:38:53Z</dc:date>
    <item>
      <title>Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325795#M95359</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to know if somebody can tell me how it is possible to commit manually the offset of a consummer ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to deactivate the "Auto Commit Enable" option on my cKafka, do what I have to do and only validate the message when everything is done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I saw I have to use&amp;nbsp;commitSync method, but I don't know how.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for your help !&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:46:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325795#M95359</guid>
      <dc:creator>SncJt</dc:creator>
      <dc:date>2024-11-16T05:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325796#M95360</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;Camel-kafka has only recently added support for manual offset commit.&lt;/P&gt; 
&lt;P&gt;Please refer to this documentation:&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://camel.apache.org/staging/components/latest/kafka-component.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://camel.apache.org/staging/components/latest/kafka-component.html&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;Let us know if the property "allowManualCommit" is what you are looking for.&lt;/P&gt; 
&lt;P&gt;Best regards&lt;/P&gt; 
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 09:48:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325796#M95360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-03T09:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325797#M95361</link>
      <description>&lt;P&gt;Hi xdshi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for the answer !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have read the doc, and tried to put this code in a cProcessor :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Import part&lt;/P&gt;
&lt;P&gt;//import java.util.List;&lt;BR /&gt;import org.apache.camel.component.kafka.KafkaManualCommit;&lt;BR /&gt;import org.apache.camel.component.kafka.KafkaConstants;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Code part :&lt;/P&gt;
&lt;P&gt;KafkaManualCommit manual = exchange.getIn().getHeader(KafkaConstants.MANUAL_COMMIT, KafkaManualCommit.class);&lt;BR /&gt;manual.commitSync();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it does not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 14:45:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325797#M95361</guid>
      <dc:creator>SncJt</dc:creator>
      <dc:date>2019-06-03T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325798#M95362</link>
      <description>&lt;P&gt;Your code worked for me.&amp;nbsp; Be sure to set&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;allowManualCommit=true&lt;/EM&gt; in Kafka Properties on the Advanced Settings tab of you cKafka component.&amp;nbsp; Of course, you'll want to uncheck &lt;EM&gt;Auto Commit Enabled&lt;/EM&gt; on Basic Settings of the component.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also found a code snip it in this article that is useful if you use Kafka's ability to grab a batch of message when consuming messages.&amp;nbsp; This snip-it will ensure it only commits if the route is on the last message of the batch.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/51843677/how-to-transactionally-poll-kafka-from-camel/52300250#52300250" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stackoverflow.com/questions/51843677/how-to-transactionally-poll-kafka-from-camel/52300250#52300250&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 13:38:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325798#M95362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-21T13:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325799#M95363</link>
      <description>&lt;P&gt;Hi cbeasley,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, it works. I was not using the correct method to check the current offset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use Kafka tools for exemple, I can see that the offset is commited manually when I decide it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, in fact, if you want to cleanly manually commit a kafka message from a Talend route, you can :&lt;/P&gt;
&lt;P&gt;- create a beans with a method kafkaManualCommit like :&lt;/P&gt;
&lt;PRE&gt;package beans;

import org.apache.camel.Exchange;
import org.apache.camel.component.kafka.KafkaManualCommit;
import org.apache.camel.component.kafka.KafkaConstants;


public class RouteCode {    
    
    /**
     * kafkaManualCommit: commit the current offset for a kafka message
     * 
     * 
     * {talendTypes} String
     * 
     * {Category} User Defined
     * 
     * {param} Exchange(exch) input: The current exchange
     * 
     * {example} kafkaManualCommit(exch) # message commited
     */
    public static void kafkaManualCommit(Exchange exch) {
        
    	KafkaManualCommit manual = exch.getIn().getHeader(KafkaConstants.MANUAL_COMMIT, KafkaManualCommit.class);
    	manual.commitSync();
    	
    }
    
}&lt;/PRE&gt;
&lt;P&gt;- set a BrokerList, ClientId, Topic and GroupId in each cKafka component&lt;/P&gt;
&lt;P&gt;- untick the "Auto commit enable" property in each cKafka consumer&lt;/P&gt;
&lt;P&gt;- set the "Auto Commit Enable" property to LATEST in each cKafka consumer&lt;/P&gt;
&lt;P&gt;- add the Kafka property "allowManualCommit" Value="true" in the advanced settings of each cKafka consumer&lt;/P&gt;
&lt;P&gt;- add a cProcessor at the end of each Route (or wherever you want to commit your offset) with the following code&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/*
* Provide own codes to consume or translate the message exchanges.
* @param org.apache.camel.Exchange exchange
*/
beans.RouteCode.kafkaManualCommit(exchange);&lt;/PRE&gt;
&lt;P&gt;It works for us like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help !&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 08:12:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325799#M95363</guid>
      <dc:creator>SncJt</dc:creator>
      <dc:date>2019-07-09T08:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Kafka - commit offset manually</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325800#M95364</link>
      <description>&lt;P&gt;hey @Beasley Chris​&amp;nbsp;would you mind showing me a screenshot of how you set this? I've tried but not able to commit on the offset and keep getting from the 1st message&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2022 23:38:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Kafka-commit-offset-manually/m-p/2325800#M95364</guid>
      <dc:creator>ANew1661729706</dc:creator>
      <dc:date>2022-08-28T23:38:02Z</dc:date>
    </item>
  </channel>
</rss>

