You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/16 06:36:43 UTC

[GitHub] [flink] abao365 opened a new pull request, #19985: flink 1.15 OffsetsInitializer.timestamp 指定offsets无效

abao365 opened a new pull request, #19985:
URL: https://github.com/apache/flink/pull/19985

   import org.apache.flink.api.common.eventtime.WatermarkStrategy;
   import org.apache.flink.api.common.serialization.SimpleStringSchema;
   import org.apache.flink.api.java.utils.ParameterTool;
   import org.apache.flink.connector.kafka.source.KafkaSource;
   import org.apache.flink.connector.kafka.source.KafkaSourceBuilder;
   import org.apache.flink.connector.kafka.source.enumerator.initializer.OffsetsInitializer;
   import org.apache.flink.streaming.api.datastream.DataStream;
   import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
   
   
   import java.util.*;
   
   public class KafkaDemo {
   
       public static void main(String[] args) throws Exception {
           StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
           env.getConfig().setGlobalJobParameters(ParameterTool.fromSystemProperties());
           List<String> topicNames = new ArrayList<>();
           topicNames.add("prod_db_ucontent_unipus_mobile_api_moduledata");
           KafkaSourceBuilder<String> kafkaSourceBuilder = KafkaSource.<String>builder()
                   .setProperty("partition.discovery.interval.ms","6000")
                   .setBootstrapServers("10.1.21.44:9092,10.1.6.141:9092,10.1.28.103:9092")
                   .setGroupId("cwf-08")
                   .setTopics(topicNames)
                   .setStartingOffsets(OffsetsInitializer.timestamp(1655353754L))
   //                .setStartingOffsets(OffsetsInitializer.latest())
                   // 从时间戳大于等于指定时间的数据开始消费
                   .setValueOnlyDeserializer(new SimpleStringSchema());
   
           KafkaSource<String> source = kafkaSourceBuilder.build();
           String sourceName = String.join( "_",topicNames);
           DataStream<String> dataStream = env.fromSource(source, WatermarkStrategy.noWatermarks(), String.format("source_"+sourceName));
           dataStream.print();
           env.execute("Fraud Detection");
       }
   }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] MartijnVisser closed pull request #19985: flink 1.15 OffsetsInitializer.timestamp 指定offsets无效

Posted by GitBox <gi...@apache.org>.
MartijnVisser closed pull request #19985: flink 1.15 OffsetsInitializer.timestamp 指定offsets无效
URL: https://github.com/apache/flink/pull/19985


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #19985: flink 1.15 OffsetsInitializer.timestamp 指定offsets无效

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #19985:
URL: https://github.com/apache/flink/pull/19985#issuecomment-1157292282

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c9a706b8388b324a37da43298e37074d0a452a34",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c9a706b8388b324a37da43298e37074d0a452a34",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c9a706b8388b324a37da43298e37074d0a452a34 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] MartijnVisser commented on pull request #19985: flink 1.15 OffsetsInitializer.timestamp 指定offsets无效

Posted by GitBox <gi...@apache.org>.
MartijnVisser commented on PR #19985:
URL: https://github.com/apache/flink/pull/19985#issuecomment-1157375454

   @abao365 Thanks for this PR, but please follow Flink's Code Contribution Guide https://flink.apache.org/contributing/how-to-contribute.html
   Closing this PR. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org