Schedule¶
Scheduling a rule allows Action Service to accumulate data and perform some action on batched data. Scheduling can be triggered based on two methods:
Count
Time
Count¶
Users need to create the following rule to trigger action with accumulated data based on the number of data.
{
"RuleId": 61,
"RuleName": "Parquet test Rule1",
"Status": "Running",
"RuleDescription": "checking",
"noOfInstance": 3,
"input": {
"type": "Direct",
"exchange": "Direct.Exchange",
"topic": "test1",
"MQName": ""
},
"schedule": {
"trigger": "periodic",
"window": "count",
"countsize": "1000"
},
"actions": [
{
"type": "ParquetAction",
"parameter": [
{
"name": "compressionCodec",
"value": "GZIP"
},
{
"name": "hdfsURL",
"value": "hdfs://192.168.161.64:8020/user1/tcs-cto/nayan/parquet/"
},
{
"name": "messageFormat",
"value": "JSON/protobuf"
},
{
"name": "fileName",
"value": "dlstest_{epoc}"
},
{
"name": "hadoop_user_name",
"value": "vagrant"
}
]
}
]
}
Time¶
Users need to create the following rule to trigger action with the accumulated data based on the time interval.
{
"RuleId": 61,
"RuleName": "Parquet test Rule1",
"Status": "Running",
"RuleDescription": "checking",
"noOfInstance": 3,
"input": {
"type": "Direct",
"exchange": "Direct.Exchange",
"topic": "test1",
"MQName": ""
},
"schedule": {
"trigger": "periodic",
"window": "time",
"starttime": "22-MAY-2018 06:57:55 UTC",
"interval":"60",
"unit":"SECONDS"
},
"actions": [
{
"type": "ParquetAction",
"parameter": [
{
"name": "compressionCodec",
"value": "GZIP"
},
{
"name": "hdfsURL",
"value": "hdfs://192.168.161.64:8020/user1/tcs-cto/nayan/parquet/"
},
{
"name": "messageFormat",
"value": "JSON"
},
{
"name": "fileName",
"value": "dlstest_{epoc}"
},
{
"name": "hadoop_user_name",
"value": "vagrant"
}
]
}
]
}
Parameter |
Required |
Values |
Description |
---|---|---|---|
trigger |
true |
string |
trigger value can be immediate or periodic. Periodic needs to be mentioned for schedule. |
window |
true |
string |
window value can be time or count. |
countsize |
true |
integer |
countsize is required for window type count. It specifies number of incoming messages. |
starttime |
false |
datetime |
it will specify when the schdeule will start. |
interval |
true |
integer |
scheduling period interval for window type time |
unit |
true |
string |
unit of interval time which can be miliseconds, seconds, minutes, hours. |
Note
Starttime needs to be specified in the format as
dd-MMM-yyy HH:mm:SS.SSS z
.If start time isblank
or given as before than the current time then the schedule will start immediately.In case of scheduling (batched data) action method argument will be list of bytes as
String Action(List<byte[]>message )
. In case of single data (in absence of schedule or trigger value as immediate) action method will accept bytes asString Action(byte[] message )
.