关注 spark技术分享,
撸spark源码 玩spark最佳实践

Trigger — How Frequently to Check Sources For New Data

Trigger — How Frequently to Check Sources For New Data

Trigger defines how often a streaming query should be executed (triggered) and emit a new data (which StreamExecution uses to resolve a TriggerExecutor).

Table 1. Trigger’s Factory Methods
Trigger Creating Instance

ContinuousTrigger

OneTimeTrigger

ProcessingTime

Note
You specify the trigger for a streaming query using DataStreamWriter‘s trigger method.

Note
Although Trigger allows for custom implementations, StreamExecution refuses such attempts and reports an IllegalStateException.

Examples of ProcessingTime

ProcessingTime is a Trigger that assumes that milliseconds is the minimum time unit.

You can create an instance of ProcessingTime using the following constructors:

  • ProcessingTime(Long) that accepts non-negative values that represent milliseconds.

  • ProcessingTime(interval: String) or ProcessingTime.create(interval: String) that accept CalendarInterval instances with or without leading interval string.

  • ProcessingTime(Duration) that accepts scala.concurrent.duration.Duration instances.

  • ProcessingTime.create(interval: Long, unit: TimeUnit) for Long and java.util.concurrent.TimeUnit instances.

赞(0) 打赏
未经允许不得转载:spark技术分享 » Trigger — How Frequently to Check Sources For New Data
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏