y9-node-redis-mq

1.0.12 • Public • Published

const callback = async (data) =>{
  const url = data.cb;
  return request({
    url: url,
    method: 'POST', 
    json: true,
    body:  data
  }, function(error, response, body) {
    if (error) {
      logger.info("回调失败.");
      logger.info(error);
    }
    logger.info("回调返回内容:"+JSON.stringify(body));
    return body;
  });
}

// //地税服务(任务处理器)
MQ.on('taskProcessor',SzDsService.taskProcessor,{
  threads:1,
  callback
});
router.post("/taskProcessor", function(req, res, next) {
  return MQ.emit('taskProcessor',req.body).then(function(response) {
    res.send(response);
  }, function(error) {
    next(error);
  });
});

Dependents (0)

Package Sidebar

Install

npm i y9-node-redis-mq

Weekly Downloads

1

Version

1.0.12

License

ISC

Last publish

Collaborators

  • ckhuang