Vert.x WriteStream setWriteQueueMaxSize

Vert.x WriteStream setWriteQueueMaxSize

我是 Vert.x 的新手。当我阅读 https://vertx.io/docs/vertx-core/java/ 文章中的 writestream 时,如下所示:

setWriteQueueMaxSize: set the number of object at which the write queue is
 considered full, and the method writeQueueFull returns true. Note that, 
when the write queue is considered full, if write is called the data will 
still be accepted and queued. The actual number depends on the stream 
implementation, for Buffer the size represents the actual number of bytes 
written and not the number of buffers.

尤其是这个陈述 - "Note that, when the write queue is considered full, if write is called the data will still be accepted and queued.",从这个陈述中,我有几个问题:

(1) 写入流有大小限制吗?我的意思是,比如事件总线,有多少消息可以写入事件总线?这取决于内存吗?假设我继续向事件总线写入消息并且消息没有被消耗,它会导致 Java 内存不足吗?

(2) 如果写入有一些限制,我在哪里以及如何查看默认队列大小?比如,我想知道Vert.xKafkaProducer的默认队列大小,在哪里可以查看?

欢迎任何想法。

那里实际上有三个不同的问题,但我还是会试一试:

Is there any size limitation for writing to stream?

这取决于流的实现。但我还没有看到一种实际使用 WriteQueueMaxSize

的实现

how many messages can be written to event bus? Does it depend on memory?

EventBus 是一个特例。如果没有人从 EventBus 消费,它只会丢弃消息,所以在这种微不足道的情况下,可以写入无限个数。但是如果有消费者,而且他们很慢,是的,最终你会 运行 内存不足。 EventBus 实现目前不对 WriteQueueMaxSize

做任何事情

If there is some limitation for writing, where and how can I check default queue size? Such as, I want to know the default queue size of Vert.x KafkaProducer, where can I check it?

所有 Vert.x 项目都是开源的,因此您通常可以在 GitHub 上找到它们(或其他开源存储库,但我不记得有哪些不在 GitHub,实际上)。

特别是Vert.x KafkaProducer,可以看这里的代码:

https://github.com/vert-x3/vertx-kafka-client/blob/1720d5a6792f70509fd7249a47ab50b930cee7a7/src/main/java/io/vertx/kafka/client/producer/impl/KafkaProducerImpl.java#L217