【问题标题】:How Callback parameter works using WebHCat/Hive?回调参数如何使用 WebHCat/Hive 工作?
【发布时间】:2014-12-29 20:36:27
【问题描述】:

我只是按照文档 WebHCat Reference Hive

我的目标是在 hive 作业状态成功后调用我的 spring 控制器。

**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 );
}

【问题讨论】:

    标签: spring hadoop hive hql hcatalog


    【解决方案1】:

    我已经在 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 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      相关资源
      最近更新 更多