public class ParseTimestamp extends AbstractProcessor
This simple processor adds a timestamp (current time in milliseconds) to all processed data items.
| Modifier and Type | Field and Description |
|---|---|
(package private) SimpleDateFormat |
dateFormat |
(package private) String |
format |
(package private) String |
from |
(package private) String |
key |
(package private) static org.slf4j.Logger |
log |
(package private) String |
timezone |
context| Constructor and Description |
|---|
ParseTimestamp() |
ParseTimestamp(String key,
String format,
String from) |
| Modifier and Type | Method and Description |
|---|---|
String |
getFormat() |
String |
getFrom() |
String |
getKey() |
String |
getTimezone() |
void |
init(ProcessContext ctx) |
Data |
process(Data data) |
void |
setFormat(String format) |
void |
setFrom(String from) |
void |
setKey(String key) |
void |
setTimezone(String timezone) |
finish, resetStatestatic org.slf4j.Logger log
SimpleDateFormat dateFormat
String key
String format
String from
String timezone
public String getTimezone()
@Parameter(required=false, description="The timezone that the processed data is assumed to refer to.") public void setTimezone(String timezone)
timezone - public String getKey()
@Parameter public void setKey(String key)
key - the key to setpublic String getFormat()
@Parameter(required=true, defaultValue="yyyy-MM-dd HH:mm:ss", description="The date format string used for parsing.") public void setFormat(String format)
format - the format to setpublic String getFrom()
@Parameter(required=true, description="The key/attribute from which the timestamp should be parsed.") public void setFrom(String from)
from - the from to setpublic Data process(Data data)
DataProcessorpublic void init(ProcessContext ctx) throws Exception
init in interface StatefulProcessorinit in class AbstractProcessorExceptionstream.AbstractProcessor#init()Copyright © 2018. All rights reserved.