消息、队列和交换的限制是什么? [英] What are the limits of messages, queues and exchanges?

查看:23
本文介绍了消息、队列和交换的限制是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 允许的消息类型有哪些(字符串、字节、整数等)?
  2. 消息的最大大小是多少?
  3. 队列和交换的最大数量是多少?

推荐答案

  1. 理论上任何东西都可以作为消息存储/发送.您实际上不想在队列中存储任何内容.如果队列大部分时间都是空的,则系统的工作效率最高.您可以使用两个先决条件将任何您想要的内容发送到队列:

  1. Theoretically anything can be stored/sent as a message. You actually don't want to store anything on the queues. The system works most efficiently if the queues are empty most of the time. You can send anything you want to the queue with two preconditions:

  • 您发送的内容可以与字节串相互转换
  • 消费者确切地知道它得到了什么以及如何将其转换为原始对象

字符串非常简单,它们有一个内置的方法来转换字节和从字节转换.如果您知道它是一个字符串,那么您就知道如何将其转换回来.最好的选择是使用标记字符串,如 XML、JSON 或 YML.通过这种方式,您可以将对象转换为字符串,然后再返回到原始对象;它们跨编程语言工作,因此您的消费者可以用与您的生产者不同的语言编写,只要它知道如何理解对象.我在 Java 工作.我想在字段中发送带有子对象的复杂消息.我使用我自己的消息对象.消息对象有两个额外的方法 toBytesfromBytes 可以在字节流之间进行转换.我使用路由键,毫无疑问消费者正在接收什么类型的消息.该消息是可序列化的.这工作正常,但有限制,因为我只能将它与其他 Java 程序一起使用.

Strings are pretty easy, they have a built in method for converting to and from bytes. If you know it is a string then you know how to convert it back. The best option is to use a markup string like XML, JSON, or YML. This way you can convert objects to Strings and back again to the original objects; they work across programming languages so your consumer can be written in a different language to your producer as long as it knows how to understand the object. I work in Java. I want to send complex messages with sub objects in the fields. I use my own message object. The message object has two additional methods toBytes and fromBytes that convert to and from the bytestream. I use routing keys that leave no doubt as to what type of message the consumer is receiving. The message is Serializable. This works fine, but is limiting as I can only use it with other Java programs.

消息的大小受服务器内存的限制,如果它是持久的,那么还有可用的硬盘空间.您可能不想发送太大的消息;发送对文件或数据库的引用可能会更好.

The size of the message is limited by the memory on the server, and if it is persistent then also the free HDD space too. You probably do not want to send messages that are too big; it might be better to send a reference to a file or DB.

您可能还想了解他们的绩效指标:http://www.rabbitmq.com/博客/2012/04/17/rabbitmq-performance-measurements-part-1/http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/

You might also want to read up on their performance measures: http://www.rabbitmq.com/blog/2012/04/17/rabbitmq-performance-measurements-part-1/ http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/

队列的重量很轻,您很可能会受到连接数的限制.这很可能取决于服务器.以下是有关类似问题的一些信息:http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-February/003042.html

Queues are pretty light weight, you will most likely be limited by the number of connections you have. It will depend on the server most likely. Here is some info on a similiar question: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2009-February/003042.html

这篇关于消息、队列和交换的限制是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆