我想从kafka主题接收和处理完成后结束流处理。停止不应该是时间特定的(awaitTerminationOrTimeout)。有没有办法在话题耗尽后停止sparkstreamingcontext。有没有办法让Dstream [T]与T值进行比较以决定控制流程?
答案 0 :(得分:0)
如果流为空,那么headOption
应该返回true并且KafkaMessageStream
在<div ng-show="loadCountry== 'success'>
<button class="btn dropdown-toggle" type="button" id="btnCntry"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedCountry}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="btnCntry">
<li ng-repeat="country in countryList">
<a>{{country.name}}</a>
</ul>
</div>
上应该为“无”,这大约是80%。
答案 1 :(得分:0)
最好的方法是,在开始阅读流之前,获取主题中所有分区的最新偏移量,然后检查接收到的偏移量何时到达那里。如果您想了解如何获取主题的偏移量,请参阅我的 previous answer 。
流程最终成为:
SimpleConsumer
OffsetRequest
最早和最新的补偿(见上一个答案)OffsetRequest
已完成