Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Use ByteBuffers for message bodies

オープン
#421 コメント 9 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
api

調査の方向性

channel.basicPublish(...) API から始め、メッセージ本文の byte[] 値がどのように変換され送信されるかを調査します。提案されている ByteBuffer と配列オフセットの代替案を、java.nio.Channel の扱いも含めて比較し、その後、採用する API を定義して、既存の動作を維持しながらメッセージ本文で不要なコピーが発生しないことを検証します。

索引モデルが issue の本文から書いたものです。

説明

Hi all,

I would like to propose to use ByteBuffer for message bodies. Now, the API accepts a plain byte[], which forces intermediate copies of buffers if we are already working with ByteBuffer or similar representations of a buffer.

Internally, the client implementation can use array() and arrayOffset() to get the data to be sent over the wire if hasArray() returns true; or copy the contents with get() in the other case. In pure NIO mode, we could simply write the ByteBuffer to the java.nio.Channel without any intermediate overhead.

What do you think?

Thank you!

addendum

FWIW, although I believe native support for ByteBuffer is the preferred solution, we could also avoid the copy if the API would accept an offset in the provided array (+ optionally the length) as an alternative proposal:

channel.basicPublish(..., buffer.array(), buffer.arrayOffset());
channel.basicPublish(..., buffer.array(), buffer.arrayOffset(), <length>);
主要言語
Java
スター
1.3k
フォーク
588
平均マージ
4時間 40分
マージ済み PR(30日)
38

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rabbitmq/rabbitmq-java-client のほかの issue

rabbitmq/rabbitmq-java-client の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。