简体   繁体   English

ActiveMQ生产者间歇性连接和持久性

[英]ActiveMQ Producer Intermittent Connection and Persistence

I am currently trying to find a solution for persistently delivering data through a producer over TCP. 我目前正在尝试寻找一种解决方案,以通过生产者通过TCP持久传递数据。 The connection can go down for long periods of time. 连接可能会断开很长时间。

Does this mean I need to implement my own form of persistence for data while I wait for the connection to be made? 这是否意味着我在等待建立连接时需要实现自己的数据持久化形式? Or is there some method such as failover, where ActiveMQ can wait for the connection to be reconnected and then persistently deliver the messages. 还是有某种方法(例如故障转移),Ac​​tiveMQ可以在其中等待连接重新连接,然后持久地传递消息。 My current problem is that I cannot create a producer if there is no connection, so my messages have nowhere to go during the time it takes to form a connection. 我当前的问题是,如果没有连接,则无法创建生产者,因此在建立连接的过程中,我的消息无处可走。

I have no problem using my own form of persistence, but I would rather use the built in persistence that ActiveMQ provides. 使用我自己的持久性形式没有问题,但是我宁愿使用ActiveMQ提供的内置持久性。

I hope my question is clear. 希望我的问题清楚。

This is a common concern and can be solved in a few ways. 这是一个普遍关注的问题,可以通过几种方法解决。 One way is the method you've described where you store the data yourself and send it when the connection comes back up. 一种方法是您描述的方法,该方法用于您自己存储数据并在连接恢复时发送数据。 Another approach that is often used is to use an embedded or local broker to produce the messages to and create a network connection between the local broker and the remote. 经常使用的另一种方法是使用嵌入式或本地代理将消息生成到本地代理和远程服务器之间,并在它们之间建立网络连接 When the connection is down the embedded broker will store the messages and when the network connection between the brokers is restored the local can forward the stored messages onto the remote broker (hub and spoke sort of). 当连接断开时,嵌入式代理将存储消息,并且当代理之间的网络连接恢复时,本地代理可以将存储的消息转发到远程代理(集线器和分支服务器)。 Keep in mind that the local broker needs sufficient storage to manage the number of messages you expect to accumulate during typical downtime between the local and remote broker. 请记住,本地代理需要足够的存储空间来管理您期望在本地和远程代理之间的典型停机期间累积的消息数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM