首页 \ 问答 \ ActiveMQ似乎不允许队列中的消息驱逐(ActiveMQ doesn't seem to allow for message eviction in queues)

ActiveMQ似乎不允许队列中的消息驱逐(ActiveMQ doesn't seem to allow for message eviction in queues)

目前,我正在使用一种设置,其中ActiveMQ用于以持久的方式控制许多消费者和许多生产者之间的消息处理。

我正在试图找出一种可以分叉队列的方法,这样我就可以有一个生产队列和一个用于分析/诊断目的的副本。 我发现制作复合队列似乎是为了满足这种需求。 生产数据可以继续正常流动,而我关心的消息是重复的,供我使用。

我对这种方法的问题在于可靠性。 我不希望分析/诊断过程阻止生产数据流,并且我也不希望ActiveMQ耗尽内存,如果消息得到备份,或者分析/诊断服务脱机。 对我来说,最好的选择是如果消息已满,消息将从分析/诊断队列中删除。

constantPendingMessageLimitStrategy可以完美地用于我的目的,但是从我从一些邮件列表中读到的内容(在尝试使其工作失败之后)是它仅支持主题。 消息TTL对我来说也不起作用(据我所知),因为该设置附加到生产者我只希望到期/丢弃/驱逐只发生在非生产队列上。

我正在尝试做什么选择?


Currently, I'm working with a setup where ActiveMQ is being used to control message processing between many consumers and many producers in a durable fashion.

I'm trying to figure out a way that I can fork the queue, such that I can have a queue for production and a copy for analytic/diagnostic purposes. I've found that making a composite queue seems to be made for this need. Production data can continue flowing normally, while the messages I care about are duplicated, for my use.

The problem I have with this approach is around reliability. I do not want the analytic/diagnostics process to block the production data flow, and I also do not want ActiveMQ to run out of memory, if messages get backed up, or the analytic/diagnostics service goes offline. For me, the preferable option is that the messages get dropped out of the analytic/diagnostics queue if it is full.

The constantPendingMessageLimitStrategy would work for my purposes perfectly, but from what I've read from some mailing lists (after trying to get it to work unsuccessfully) is that it is only supported for topics. Message TTL also does not work for me (from what I can tell), because that setting is attached to the producer I only want expiry/drop/eviction to only happen on the non-production queue.

What are the options for what I'm trying to do?


原文:https://stackoverflow.com/questions/24684548
更新时间:2023-02-22 14:02

最满意答案

您可以围绕Reflection创建自己的Java包装器,它调用反射API并从JNI而不是反射API调用它。 这将是更轻量级的解决方案。


You can create your own Java wrapper around Reflection which calls reflection API and call it from JNI instead of reflection API. This would be much lighter weight solution.

相关问答

更多
  • 你的实现问题是jstring数据成员。 NewStringUTF()创建一个Java String对象以从JNI方法返回。 所以这是一个Java本地引用。 但是,您将它存储在C ++对象中,并尝试在JNI调用中使用它。 您应该更好地区分C ++对象,Java和它们之间的JNI接口。 换句话说,C ++应该使用C ++方式来存储字符串(如std::string )。 InvokeNativeFunction()的JNI实现应该将其转换为一个jstring作为返回值。 PS:有些情况下需要C ++实现来保持对J ...
  • 明显的问题是pax_store_get_data_avail_info()不是DataAvailable的方法。 这是其他一些类的方法吗? 你实际上并没有说它是什么。 但我们假设它是: class X { public native int pax_store_get_data_avail_info(DataAvailable[] stats_array); } 当你调用这个方法时,你得到的jclass jclass1参数是“X”,而不是DataAvailable。 因此,您对GetMethodID ...
  • 对cout和printf C ++调用不会显示在LogCat输出中。 有两种解决方案。 使用NDK提供的记录宏允许您将消息记录到LogCat。 这对于您正在编写的新代码和包装代码很有用,但是当您拥有一个充满现有调试语句的库时不太好。 我将宏定义如下: #define LOG_INFO(info) __android_log_write(ANDROID_LOG_INFO,"JNI",info) #define LOG_ERROR(error) __android_log_write(ANDROID_LOG_E ...
  • 我曾经使用命令行来做。 转到源文件目录。 javac filename.java生成filename.class文件。 javah filename生成filename.h文件。 您可以参考javac和javah获取更多帮助。 I used to do it using command line. go to the source file directory. javac filename.java to generate filename.class file. javah filename to ge ...
  • 实际上,我解决了它: JNIEXPORT jobject JNICALL Java_com_rmsdk_wrapper_RMServices_getBookmarkNew( JNIEnv *env, jobject thiso) { jclass cls = g_jniEnv->FindClass("br/com/iba/model/Annotation"); jobject obj = g_jniEnv->AllocObject(cls); jmethodID meth1 = ...
  • 当然。 它实际上比链接的例子要容易得多,因为你不必生成一个JVM来完成它 - 调用你的java函数为你提供了一个指向你可以使用的环境的指针。 举个简单的例子:使用这样的Java类: public class foo { static { // load libfoo.so / foo.dll System.loadLibrary("foo"); } private native void nativecall(); public static void main(Stri ...
  • RegisterNatives不添加新的本地方法,它为类中现有的本地方法注册本地函数。 如果有人没有为本地方法调用RegisterNatives,那么当第一次调用方法时, JVM将搜索所有DLL库的实现。 因此,添加implements Listener ,用native关键字编写定义并将其实现RegisterNatives到RegisterNatives 。 RegisterNatives doesn't add new native methods, it registers native functi ...
  • 您可以围绕Reflection创建自己的Java包装器,它调用反射API并从JNI而不是反射API调用它。 这将是更轻量级的解决方案。 You can create your own Java wrapper around Reflection which calls reflection API and call it from JNI instead of reflection API. This would be much lighter weight solution.
  • 我不相信有一个更优雅的解决方案,而不是你为库编写JNI包装器的建议。 无论如何,这可能不是一个好主意,因为您应该为要支持的每个体系结构编译所有本机代码的单独版本。 只是附加到已编译的库意味着你被它的架构所困扰。 I do not believe there is a more elegant solution than the one you suggested of writing a JNI wrapper for the library. It is probably not a good idea ...
  • 在Java文件上运行javah ,声明本机方法,您将看到需要两个不同的Java_com_xxx函数。 C级声明必须是唯一的。 Run javah on your Java file declaring the native methods and you will see that you need two different Java_com_xxx functions. The C-level declarations must be unique.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)