我正在构建一个扩散解决方案,创建一个主题树.
我正在按需创建主题以反映从RabbitMQ订阅源收到的值.每个主题都有一个内存成本,所以我希望一旦它没有订阅者一段时间就删除该主题.
如何使用统一的Java API完成这项工作?
我正在研究Diffusion JS API的一些代码示例,但我不了解重新连接的示例.reconnectionStrategy有哪些start和哪些abort参数?
// Create a reconnection strategy that applies an exponential back-off
var reconnectionStrategy = (function() {
return function(start, abort) {
var wait = Math.min(Math.pow(2, attempts++) * 100, maximumAttemptInterval);
// Wait and then try to start the reconnection attempt
setTimeout(start, wait);
};
})();
// Connect to the server.
diffusion.connect({
host : 'diffusion.example.com',
port : 443,
secure : true,
principal : 'control',
credentials : 'password',
reconnect : {
timeout : maximumTimeoutDuration,
strategy : reconnectionStrategy
}
}).then(function(session) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Diffusion的.NET客户端库更新JSON主题.我知道目前在.NET中只有部分支持JSON主题,但我认为可以更新主题.所以我使用Javascript客户端api创建了一个主题,然后使用C#进行更新.使用以下命令创建主题:
var initvalue = diffusion.datatypes.json().from({ "name" : "some transaction example", "price": 2.00 });
session.topics.add("examples/rmq/testtopic", initvalue);
Run Code Online (Sandbox Code Playgroud)
但在C#中更新它:
updateControl.Updater.Update("examples/rmq/testtopic", "{'name': 'some other trans','price':20}", new TopicUpdaterUpdateCallback(st));
Run Code Online (Sandbox Code Playgroud)
将初始值变为void/empty.
我无法找到有关JSON主题和.NET的任何资源,所以非常感谢您的帮助.
我\xe2\x80\x99m 在我们的预生产环境中测试扩散解决方案。该解决方案为匿名客户端提供 10 分钟的免费访问时间,然后他们必须进行身份验证或断开连接。这在开发和早期测试中效果很好,但在预生产中,当一个客户端断开连接时,我们会看到许多其他客户端同时无故断开连接。一旦日志记录设置为 FINEST,日志文件就会显示:
\n\n2016-03-21 11:57:36.557|DEBUG|Diffusion: InboundThreadPool Thread_4||NIOBufferedChannel@52e2a219[connected local=/10.0.4.1:8080 remote=/10.0.1.99:58673] : Closed(UNEXPECTED_ERROR) Unexpected error EOF|com.pushtechnology.diffusion.io.message.MessageChannelException\n2016-03-21 11:57:36.558|DEBUG|Diffusion: InboundThreadPool Thread_4||Java Client 50328FF242799CD4-000000000000015A AWAITING_RECONNECTION@10.0.1.99: State changed from CONNECTED to AWAITING_RECONNECTION.|com.pushtechnology.diffusion.clients.impl.ClientImpl\n2016-03-21 11:57:36.558|DEBUG|Diffusion: InboundThreadPool Thread_4||Java Client 50328FF242799CD4-000000000000015A AWAITING_RECONNECTION@10.0.1.99: CONNECTION_LOST keeping alive for 60000 ms.|com.pushtechnology.diffusion.clients.impl.ClientImpl\nRun Code Online (Sandbox Code Playgroud)\n\n受影响的客户端始终是浏览器,而不是智能手机。通常是较旧的浏览器,例如 IE9。
\n我可以从文档中看到我如何集成Java Web服务器或IIS,但我无法看到如何使用PHP与Diffusion或Reappt集成我们的Apache服务器.我看到有一个C客户端,但我没有为此构建一个PHP包装器.PHP无处不在,我错过了什么?
我正在尝试获取扩散实例中所有主题的列表.我有多个根主题,所有主题都有自己的子主题.我只需要通过其层次结构获取服务器上的任何内容.我已经联系了扩散支持,他们告诉我JS api中没有这样的方法.这可行吗?
我现在正在最后建立扩散5.9.
我必须为 websockets(扩散)使用非开源发布/订阅库,并且必须坚持使用特定版本,因为它是在服务器端使用的,我无法控制它。
问题是,在他们的代码库中的一个单独的 util 中,他们使用了保留关键字interface并触发了一个破坏构建的缩小错误:
Failed to minify the code from this file:
./node_modules/babel-loader/lib??ref--6-oneOf-2!./node_modules/diffusion/src/node_modules/util/interface.js:127
Read more here: bit.ly/CRA-build-minify
Run Code Online (Sandbox Code Playgroud)
我可以使用哪个正则表达式从缩小中排除此依赖项?
config.optimization.minimizer[0].options.exclude = /node_modules/; 不会将其排除在缩小之外。
config.optimization.minimizer[0].options.exclude = /^.*(node_modules|.js).*$/; 有效,但它太宽泛了
有关更多上下文,这是导致缩小失败的依赖项代码:
node_modules/diffusion/src/node_modules/util/interface.js
function _implements() {
var args = Array.prototype.slice.call(arguments, 0);
var impl = args.pop();
var unsatisfied = [];
...
// The joys of duck type. Quack quack
args.forEach(function(interface) { <<<<<<<<<<<<<<<<<<<<<
unsatisfied = unsatisfied.concat(interface(impl));
});
Run Code Online (Sandbox Code Playgroud)
这是 webpack 配置文件在我覆盖之前的样子:(我们不允许弹出)
"optimization": {
"minimizer": [
{
"options": {
"test": {
},
"extractComments": false, …Run Code Online (Sandbox Code Playgroud)