- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
此处使用 Apache 2.11.0。我正在编写一个基于 Camel 的小应用程序(使用 Spring XML),它从队列 (inputQueue
) 中获取消息,聚合它们,处理聚合的批处理,然后发送生成的报告。我想将此应用程序 (widget-reporter.war
) 部署到多个 Tomcat 实例并将它们集群,这样如果一个节点出现故障,它仍在其他节点上运行并且报告仍会得到生成。
目前路由的伪代码如下:
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<route id="myRoute">
<from uri="activemq:queue:inputQueue" />
<aggregate strategyRef="myStrategy" completionSize="500">
<correlationExpression>
<xpath>/fizz/buzz</xpath>
</correlationExpression>
<to uri="bean:reportGenerator?method=runReport"/>
</aggregate>
</route>
</camelContext>
因此,如您所见,我们从 inputQueue
中取出消息,将它们发送到聚合器(在 xpath 表达式上关联它们),在达到 500 条消息后,我们发送聚合交换关闭到 reportGenerator
。
我在本地(1 个节点)完美地运行了它。现在我正尝试将此应用程序部署到多个 Tomcat 实例,但我只希望它一次在 1 个节点上运行。换句话说,如果我将这个应用程序部署到 5 个 Tomcat 实例,我不希望 5 个 Tomcat 同时从 inputQueue
消耗:在任何给定时间只有 1 个应该运行,并且其他 4 个应该处于空闲状态,等待主节点故障转移到它们。
看起来 Camel Quartz
允许这样的集群,但问题是它要求我以 quartz://
端点开始我的路线,而不是 activemq
。所以我必须有这样的东西(这是行不通的):
<route id="myRoute">
<from uri="quartz://runWidgetReporterExclusively?cron=0+15,45+0-16+?+*+SAT" />
<!-- Can't have 2 consecutive "from" endpoints... -->
<from uri="activemq:queue:inputQueue" />
<aggregate strategyRef="myStrategy" completionSize="500">
<correlationExpression>
<xpath>/fizz/buzz</xpath>
</correlationExpression>
<to uri="bean:reportGenerator?method=runReport"/>
</aggregate>
</route>
有人知道我该怎么做吗:
最佳答案
使用 camel-zookeeper为此启用 RoutePolicy...
ZooKeeper allows for very simple and effective leader election out of the box; This component exploits this election capability in a RoutePolicy to control when and how routes are enabled. This policy would typically be used in fail-over scenarios, to control identical instances of a route across a cluster of Camel based servers. A very common scenario is a simple 'Master-Slave' setup where there are multiple instances of a route distributed across a cluster but only one of them, that of the master, should be running at a time. If the master fails, a new master should be elected from the available slaves and the route in this new master should be started.
关于java - 如何将 Camel Quartz 集群与队列消费结合使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21553252/
我想使用我编写的类模块的事件。类模块如下所示 ''CError64Row Public Event ErrorClicked(ByVal row As Integer, ByVal column As
我正在寻找实现智能架构的良好实践,以及处理针对具有许多不同 wdsl web 服务的系统的集成的方法。 我已经有 2 年的爱好使用 C# 进行开发了~,因此我并不总是使用正确的术语,但我会尝试描述我正
目前,我正在为我的程序使用 Azure Consumer API。但它非常慢,几乎需要8秒才能给出响应。我现在应该怎么做?这是我正在使用的 azure API.. https://management
我的流程是: AcitveMQ 控制台在主题部分下显示了一个使用者,但是一旦
我一直在阅读类似 Why does a function that accepts a Box complain of a value being moved when a function that
AMQP 函数 consume() 是一个带有回调的阻塞函数,是否可以为 consume() 函数设置超时,以便在特定时间后不再阻塞并且代码执行完成? 最佳答案 是的,方法如下: $amqp = ne
我有一个客户端/服务器应用程序,其中客户端以 JSON 形式将对象发送到运行 PHP 脚本的服务器,然后将此数据放入数据库。 问题是解码是用 json_decode 函数完成的,它似乎适用于字符串而不
所以我已经模拟了我的生产者消费者问题并且我有下面的代码。我的问题是:如果消费者一直处于 while(true) 状态,他如何停止。 在下面的代码中,我添加了 i
我无法使用在delphi 中开发的dll 的功能。我在类型转换方面遇到了一些困难。 这是我要调用 DLL 的函数: function rData(ID: Cardinal; queue: WideSt
我想使用 Unity3D 可视化 Kafka 流。在 Unity 中访问数据流的最佳方式是什么? 我已经用 Node 和 C# 编写了基本使用者,但我不确定如何将它们合并到 Unity 中。任何帮助表
如果标题太笼统,我很抱歉,但我已经浏览了一个小时的互联网,但找不到任何架构解释。我对 RSS 和 Atom 协议(protocol)都是全新的,据我到目前为止所了解的是: 服务器发布文档 客户端订阅此
我很喜欢我刚刚发现的 Guzzle 框架。我正在使用它使用不同的响应结构跨多个 API 聚合数据。它可以使用 JSON 和 XML 找到,但我需要使用的服务之一使用 SOAP。是否有使用 Guzzle
有没有一种方法可以像访问 Microsoft.Azure.Management.Fluent 一样访问 Azure.Management.Conclusion.Models? 当我执行以下代码时,我看
我有这个部分场景图树: CustomPane (with onMouseClicked Handler) → ChildNode (with onMousePressed Handler) 当我在
我的问题是这个 json。 http://dev-rexolution.pantheonsite.io/api/noticias 我只需要使用 vuejs 2 使用数组的第一个元素才能显示它,使用我工
我是 ML 新手,一直在研究 CNTK 教程。我已经成功训练了几个模型。 我完成了迁移学习教程 ( https://github.com/Microsoft/CNTK/blob/v2.1/Tutori
我是 RabbitMq 和 AMQP 的新手,但我对 ActiveMQ 和 JMS 有一些经验。我尝试在主题(JMS 中的主题之类的主题)中发布一条消息,并从多个监听器中使用此消息。比如我发布一条消息
我正在尝试让我的服务器解析以下 JSON: {"hardwareId":1,"registerTime":"2017-02-14T03:42:11.482Z","sensorId":1,"temper
我正在开发一个从外部 url 使用 json 的网站,我试过了但是我得到了一个错误 XMLHttpRequest 无法加载 http://reuniyo.com/tst/json.php。 Acces
我正在尝试使用Kafka Streams(即不是简单的Kafka Consumer)从重试主题中读取之前无法处理的事件。我希望从重试主题中进行消费,如果处理仍然失败(例如,如果外部系统已关闭),我希望
我是一名优秀的程序员,十分优秀!