简体   繁体   English

JMS IBM MQ-限制浏览时返回消息的大小

[英]JMS IBM MQ - limit the size of the returned message on browse

In my scenario the queue contains huge (32MB+) messages, and the data is structured such that the information that identifies the type of message, is contained in the first few bytes of the message. 在我的场景中,队列包含大量(32MB +)消息,并且数据的结构使得标识消息类型的信息包含在消息的前几个字节中。

When using the low-level Websphere MQ API it is possible to provide a buffer of a specific (limited) size, then issue the MQGET call with options that include the MQGMO_ACCEPT_TRUNCATED_MSG flag. 使用低级Websphere MQ API时,可以提供特定(有限)大小的缓冲区,然后使用包含MQGMO_ACCEPT_TRUNCATED_MSG标志的选项发出MQGET调用。 The reason code returned by the MQGET would then probably be MQRC_TRUNCATED_MSG_ACCEPTED (which is to be expected). 然后,MQGET返回的原因代码可能是MQRC_TRUNCATED_MSG_ACCEPTED(这是预期的)。

This enables one to write a very fast "browse all" kind of logic that returns the first (lets say) 100 bytes of each message instead of the full buffer for each. 这使人们能够编写非常快速的“浏览所有”类型的逻辑,该逻辑返回每个消息的第一个(可以说)100个字节,而不是每个消息的完整缓冲区。

Is it possible to do something similar using java JMS? 使用Java JMS可以做类似的事情吗? I have not been able to find anything that allows me to specify a buffer size on either the session.createBrowser(queue...) or the browser.getEnumeration() calls. 我找不到任何可以在session.createBrowser(queue ...)或browser.getEnumeration()调用上指定缓冲区大小的东西。

Thanks. 谢谢。

Instead of selecting a pattern then defining your data, you have data and want to force it to fit a pattern. 您没有选择一个模式然后定义您的数据,而是拥有了数据,并希望强制其适应模式。 That's a little backwards. 这有点倒退。

Questions: 问题:

(1) Are you putting different types of data into the same queue? (1)您是否将不同类型的数据放入同一队列? ie multiple and different type of senders? 即多个和不同类型的发件人?

(2) Is the sender (publisher) a JMS application? (2)发送者(发布者)是JMS应用程序吗?

(3) Are you trying to create an application that will move/filter messages like what IIB (Message Broker) would do? (3)您是否正在尝试创建一个将移动/过滤消息的应用程序,如IIB(消息代理)那样? If not, then what is the real purpose of your program? 如果没有,那么您的程序的真正目的是什么?


Each unique application should have its own queue. 每个唯一的应用程序应具有其自己的队列。 Queues should be handed out like candle to kids on Halloween. 在万圣节那天,队列应该像蜡烛一样分发给孩子们。

ie Lets say HR has the following 5 applications: 即可以说HR有以下5个应用程序:

  • Recruiting 招聘
  • Payroll 工资表
  • Benefits 优点
  • Training 训练
  • Employees 雇员

Do not create a queue called 'HR.Q' that will process all of the HR messages. 不要创建名为“ HR.Q”的队列来处理所有HR消息。 Bad design, bad to support. 设计不好,支持不好。

Rather each unique application should have its own queue. 而是每个唯一的应用程序都应该有自己的队列。 ie

  • 'HR.RECRUITING.Q' 'HR.RECRUITING.Q'
  • 'HR.PAYROLL.Q' 'HR.PAYROLL.Q'
  • 'HR.BENEFITS.Q' 'HR.BENEFITS.Q'
  • 'HR.TRAINING.Q' 'HR.TRAINING.Q'
  • 'HR.EMPLOYEES.Q' 'HR.EMPLOYEES.Q'

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

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