1

我只是按照 WebHCat Reference Hive中的文档

我的目标是在蜂巢作业状态成功后调用我的弹簧控制器。

**here are my inputs :** 

**url** : http://localhost:50111/templeton/v1/hive?user.name=hduser

**Parameter:**
callback : http://domain:port/project-name/mycall/$jobId

$jobId 只是一个参数,一旦处理完成,它将被替换为实际的 jobId。

** here is my controller : ** 

@RequestMapping(value = "/mycall/{jobId}", method = RequestMethod.GET)
    public void callBack( @PathVariable String jobId) throws IOException {
LOGGER.debug("JobId : {}", jobId );
}
4

1 回答 1

0

我已经在 node.js 中使用 express 成功完成了这项工作。我会试着解释一下。

首先我使用请求模块提交作业

var cmd = "http://"+targ+":"+port+"/templeton/v1/hive";
request({
    method: 'POST',
    url: cmd,
    form: {
        'user.name': user, // just a variable for user.name=
        'execute': query, // actual query string
        'statusdir': dir,  // directory results will go on hdfs
        'callback': "http://"+ip+":3000/callback/$jobId", // callback address
    }
}, function(err, response, body){

现在是接收回调的路由。

router.get('/:jobid', function(req, res) {
  var jobid = req.param('jobid');
  console.log(jobid, 'get: /callback/:jobid');
  i.alert(jobid);
  res.status(200).end();
});

/callback 位于调用路由的 app.js 中,如果您不熟悉节点。

于 2015-01-01T20:46:53.867 回答