Github user Parth-Brahmbhatt commented on a diff in the pull request:
https://github.com/apache/storm/pull/900#discussion_r47557478
--- Diff: docs/documentation/Windowing.md ---
@@ -126,6 +126,96 @@ Time duration based tumbling window that tumbles after
the specified time durati
```
+## Tuple timestamp and out of order tuples
+By default the timestamp tracked in the window is the time when the tuple
is processed by the bolt. The window calculations
+are performed based on the processing timestamp. Storm has support for
tracking windows based on the source generated timestamp.
+
+```java
+/**
+* Specify a field in the tuple that represents the timestamp as a long
value. If this
+* field is not present in the incoming tuple, an {@link
IllegalArgumentException} will be thrown.
+*
+* @param fieldName the name of the field that contains the timestamp
+*/
+public BaseWindowedBolt withTimestampField(String fieldName)
+```
+
+The value for the above `fieldName` will be looked up from the incoming
tuple and considered for windowing calculations.
+If the field is not present in the tuple an exception will be thrown.
Along with the timestamp field name, a time lag parameter
+can also be specified which indicates the max time limit for tuples with
out of order timestamps.
+
+E.g. If the lag is 5 secs and a tuple `t1` arrived with timestamp
`06:00:05` no tuples may arrive with tuple timestamp earlier than `06:00:00`.
If a tuple
+arrives with timestamp 05:59:59 after `t1` and the window has moved past
`t1`, it will be treated as a late tuple and not processed.
--- End diff --
Lets also document how users can find out number of discarded tuples? In
many cases it may also be useful to provide a handler for tuples being
discarded but I am fine with not including that in this patch.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---