Tag: hystrix

无法处理hystrix模块中的request-promise-json错误

我是节点js的新手,我必须在节点js中为我的项目实现hystrix弹性库,但我坚持一点。 我面临的问题是,每当我从我的服务器应用程序发送错误代码(4xx,5xx),我不能使用诺言来处理它们。 我粘贴我的app.js和server.js文件的代码。尽pipe该项目有其他几个文件,但这些文件是用于启动所有的进程,但唯一的问题是在app.js。 请帮助我如何有效地处理被拒绝的承诺错误,以便我没有得到未定义的res,身体在app.js的 isErrorHandler方法。 我还将添加控制台数据。 app.js var express = require('express'), Promise = require('q'), request = require('request'), getRandomInt = require('./random_int'), http = require('request-promise-json'), _ = require("lodash"), hystrixStream = require('../../lib/http/HystrixSSEStream'), CommandsFactory = require("../../lib/command/CommandFactory"); var makeRequest = function(options) { var req = _.assign(options); return http.request(req); }; function hystrixStreamResponse(request, response) { response.append('Content-Type', 'text/event-stream;charset=UTF-8'); response.append('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate'); […]

如何在节点应用程序中configurationHystrixjs?

我正在尝试将hystrixJSconfiguration为我的一个nodejs应用程序。 我想包装我的应用程序正在做的外部依赖项的几个。 https://www.npmjs.com/package/hystrixjs 我读了自述文件,但我仍然无法得到如何包装我的依赖关系调用这个hystrix和如何configuration仪表板为此。 如果有人已经尝试过,请给我一些指导。 谢谢。