请问timeout值是多少?在哪里可设置?



在 2020-06-18 17:43:31,"Benchao Li" <libenc...@apache.org> 写道:
>我理解现在就是你想要的效果。
>batch-size和timeout两个条件是达到一个就会flush的。
>
>nicygan <read3...@163.com> 于2020年6月18日周四 下午5:05写道:
>
>> dear all:
>>  我想用JDBCAppendTableSink向Mysql写数据,可以设置批量大小,不能设置间隔时间。
>>
>>
>> JDBCAppendTableSink sink = JDBCAppendTableSink.builder().setBatchSize(1)
>>                 .setDrivername("com.mysql.jdbc.Driver")
>>                 .setDBUrl("jdbc:mysql://localhost:3306/flink")
>>                 .setUsername("root")
>>                 .setPassword("123456")
>>                 .setQuery(sql2)
>>                 .setParameterTypes(types)
>>  .setBatchSize(1000)
>>                .build();
>>
>> =========== 问题 ================
>> 如果上游数据来源时间是:
>> 10:00 -> 900条
>> 10:10 -> 120条
>> 11:50 -> 1100条
>> 15:00 -> 900条
>>
>> JDBCAppendTableSink的数据写入Mysql时间是怎样的? 我的理解是
>> 10:10 -> 写入1000条,剩20条下次写入
>> 11:50 -> 写入1000条,剩30条下次写入
>> 15:00 -> 写入1000条,剩10条下次写入
>>
>> 我想要达到等待20分种,不满足batchSize也写入,能否实现?
>> 10:10 -> 写入1000条,剩20条下次写入
>> 10:30 -> 写入20条
>> 11:50 -> 写入1000条,剩10条下次写入
>> 12:10 -> 写入10条
>> 15:20 -> 写入900条
>>
>> thanks
>>
>
>
>-- 
>
>Best,
>Benchao Li

回复