public class HttpTriggerAction extends Object implements TriggerAction
To use this trigger, two types of configurations must be set. First, this class must be configured to be invoked for a given trigger event. Second, the the relevant settings for the HTTP request(s) to be made must be set as described below.
The general format of this classes configs is
chukwa.trigger.[eventName].http.[N].[paramName]
where
eventName
is the name of the event the request values are bound
to (see TriggerEvent), N
is a counter for each request configured (starting at 1)
and paramName
is the request parameter being set.
Using the post demux success trigger event as an example, the first request to be fired would use the following configurations
chukwa.trigger.post.demux.success.http.1.url
- The HTTP url to
invoke.chukwa.trigger.post.demux.success.http.1.method
- The HTTP method
(optional, default=GET).chukwa.trigger.post.demux.success.http.1.headers
- A comma-delimited
set of HTTP headers (in [headerName]:[headerValue]
form) to
include (optional).chukwa.trigger.post.demux.success.http.1.body
- The text HTTP body
to include (optional).chukwa.trigger.post.demux.success.http.1.connect.timeout
- The
HTTP connection timeout setting in milliseconds (optional, default=5000ms).chukwa.trigger.post.demux.success.http.1.read.timeout
- The
HTTP read timeout setting in milliseconds (optional, default=5000ms).TriggerAction
,
TriggerEvent
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
HttpTriggerAction() |
Modifier and Type | Method and Description |
---|---|
void |
execute(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus[] src,
TriggerEvent triggerEvent)
Iterates over each URL found, fetched other settings and fires and HTTP
request.
|
protected String |
getBody(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
protected int |
getConnectTimeout(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
protected Map<String,String> |
getHeaders(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
protected String |
getMethod(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
protected int |
getReadTimeout(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
protected URL |
getUrl(org.apache.hadoop.conf.Configuration conf,
TriggerEvent triggerEvent,
int reqNumber) |
public void execute(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.FileStatus[] src, TriggerEvent triggerEvent) throws IOException
execute
in interface TriggerAction
conf
- fs
- src
- triggerEvent
- IOException
protected URL getUrl(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber) throws MalformedURLException
MalformedURLException
protected String getMethod(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber)
protected Map<String,String> getHeaders(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber)
protected String getBody(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber)
protected int getConnectTimeout(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber)
protected int getReadTimeout(org.apache.hadoop.conf.Configuration conf, TriggerEvent triggerEvent, int reqNumber)
Copyright © 2014 Apache Software Foundation. All Rights Reserved.