From 2ef9c1ce62ea8041a1b55ff3c14547c461f1a690 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Fri, 6 Mar 2026 11:24:31 +0000 Subject: [PATCH 1/3] chore: add branch placeholder zbobr_fix-34-fix-issue-428 --- .zbobr/zbobr_fix-34-fix-issue-428 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .zbobr/zbobr_fix-34-fix-issue-428 diff --git a/.zbobr/zbobr_fix-34-fix-issue-428 b/.zbobr/zbobr_fix-34-fix-issue-428 new file mode 100644 index 0000000..e69de29 From 51497807f4eacc33d0342bad9f555d7d7119fa05 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Fri, 6 Mar 2026 11:24:31 +0000 Subject: [PATCH 2/3] Deprecate priority and congestion_control on reply QoS Following eclipse-zenoh/zenoh#2382, deprecate the `priority` and `congestionControl` fields in `ReplyOptions` and `ReplyDelOptions`. Remove corresponding parameters from the JNI bridge (Rust and Kotlin) so that Rust uses its own defaults for these values. Update tests to no longer assert on priority/congestion_control in reply samples. Fixes #428 Co-Authored-By: Claude Opus 4.6 --- .../kotlin/io/zenoh/jni/JNIQuery.kt | 12 ++--------- .../commonMain/kotlin/io/zenoh/query/Reply.kt | 4 ++++ .../jvmTest/java/io/zenoh/QueryableTest.java | 21 ++++--------------- zenoh-jni/src/query.rs | 17 --------------- 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/zenoh-java/src/commonMain/kotlin/io/zenoh/jni/JNIQuery.kt b/zenoh-java/src/commonMain/kotlin/io/zenoh/jni/JNIQuery.kt index afda43e..0b1683f 100644 --- a/zenoh-java/src/commonMain/kotlin/io/zenoh/jni/JNIQuery.kt +++ b/zenoh-java/src/commonMain/kotlin/io/zenoh/jni/JNIQuery.kt @@ -43,9 +43,7 @@ internal class JNIQuery(private val ptr: Long) { timestampEnabled, if (timestampEnabled) sample.timestamp!!.ntpValue() else 0, sample.attachment?.bytes, - sample.qos.express, - sample.qos.priority.value, - sample.qos.congestionControl.value + sample.qos.express ) } @@ -62,9 +60,7 @@ internal class JNIQuery(private val ptr: Long) { timestampEnabled, if (timestampEnabled) timestamp!!.ntpValue() else 0, attachment?.into()?.bytes, - qos.express, - qos.priority.value, - qos.congestionControl.value + qos.express ) } @@ -84,8 +80,6 @@ internal class JNIQuery(private val ptr: Long) { timestampNtp64: Long, attachment: ByteArray?, qosExpress: Boolean, - qosPriority: Int, - qosCongestionControl: Int, ) @Throws(ZError::class) @@ -105,8 +99,6 @@ internal class JNIQuery(private val ptr: Long) { timestampNtp64: Long, attachment: ByteArray?, qosExpress: Boolean, - qosPriority: Int, - qosCongestionControl: Int, ) /** Frees the underlying native Query. */ diff --git a/zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt b/zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt index 8113982..c69dc34 100644 --- a/zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt +++ b/zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt @@ -93,7 +93,9 @@ data class ReplyOptions( var timeStamp: TimeStamp? = null, var attachment: IntoZBytes? = null, var express: Boolean = QoS.defaultResponse.express, + @Deprecated("Congestion control on reply QoS is deprecated and will be ignored. See eclipse-zenoh/zenoh#2382.") var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl, + @Deprecated("Priority on reply QoS is deprecated and will be ignored. See eclipse-zenoh/zenoh#2382.") var priority: Priority = QoS.defaultResponse.priority ) { fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) } @@ -112,7 +114,9 @@ data class ReplyDelOptions( var timeStamp: TimeStamp? = null, var attachment: IntoZBytes? = null, var express: Boolean = QoS.defaultResponse.express, + @Deprecated("Congestion control on reply QoS is deprecated and will be ignored. See eclipse-zenoh/zenoh#2382.") var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl, + @Deprecated("Priority on reply QoS is deprecated and will be ignored. See eclipse-zenoh/zenoh#2382.") var priority: Priority = QoS.defaultResponse.priority ) { fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) } diff --git a/zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java b/zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java index 8a2da00..83efb60 100644 --- a/zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java +++ b/zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java @@ -6,8 +6,6 @@ import io.zenoh.handlers.Handler; import io.zenoh.keyexpr.KeyExpr; import io.zenoh.query.*; -import io.zenoh.qos.CongestionControl; -import io.zenoh.qos.Priority; import io.zenoh.qos.QoS; import io.zenoh.sample.Sample; import io.zenoh.sample.SampleKind; @@ -47,16 +45,6 @@ public void tearDown() throws ZError { public void queryableRunsWithCallback() throws ZError, InterruptedException { var timestamp = new TimeStamp(Date.from(Instant.now())); - var sample = new Sample( - testKeyExpr, - testPayload, - Encoding.defaultEncoding(), - SampleKind.PUT, - timestamp, - new QoS(CongestionControl.BLOCK, Priority.DATA, false), - null - ); - var queryable = session.declareQueryable(testKeyExpr, query -> { try { @@ -73,7 +61,10 @@ public void queryableRunsWithCallback() throws ZError, InterruptedException { Thread.sleep(1000); assertNotNull(reply[0]); Sample receivedSample = ((Reply.Success) reply[0]).getSample(); - assertEquals(sample, receivedSample); + assertEquals(testPayload, receivedSample.getPayload()); + assertEquals(Encoding.defaultEncoding(), receivedSample.getEncoding()); + assertEquals(SampleKind.PUT, receivedSample.getKind()); + assertEquals(timestamp, receivedSample.getTimestamp()); queryable.close(); } @@ -137,8 +128,6 @@ public void queryReplySuccessTest() throws ZError, InterruptedException { Queryable queryable = session.declareQueryable(testKeyExpr, query -> { var options = new ReplyOptions(); options.setTimeStamp(timestamp); - options.setPriority(Priority.DATA_HIGH); - options.setCongestionControl(CongestionControl.DROP); options.setExpress(true); try { query.reply(testKeyExpr, message, options); @@ -158,9 +147,7 @@ public void queryReplySuccessTest() throws ZError, InterruptedException { var sample = ((Reply.Success) receivedReply[0]).getSample(); assertEquals(message, sample.getPayload()); assertEquals(timestamp, sample.getTimestamp()); - assertEquals(Priority.DATA_HIGH, sample.getPriority()); assertTrue(sample.getQos().getExpress()); - assertEquals(CongestionControl.DROP, sample.getCongestionControl()); } @Test diff --git a/zenoh-jni/src/query.rs b/zenoh-jni/src/query.rs index a5c601e..9c84389 100644 --- a/zenoh-jni/src/query.rs +++ b/zenoh-jni/src/query.rs @@ -25,7 +25,6 @@ use jni::{ use uhlc::ID; use zenoh::{ key_expr::KeyExpr, - qos::{CongestionControl, Priority}, query::Query, time::{Timestamp, NTP64}, Wait, @@ -71,8 +70,6 @@ pub(crate) unsafe extern "C" fn Java_io_zenoh_jni_JNIQuery_replySuccessViaJNI( timestamp_ntp_64: jlong, attachment: /*nullable*/ JByteArray, qos_express: jboolean, - qos_priority: jint, - qos_congestion_control: jint, ) { let _ = || -> ZResult<()> { let query = Arc::from_raw(query_ptr); @@ -89,12 +86,6 @@ pub(crate) unsafe extern "C" fn Java_io_zenoh_jni_JNIQuery_replySuccessViaJNI( reply_builder = reply_builder.attachment(decode_byte_array(&env, attachment)?); } reply_builder = reply_builder.express(qos_express != 0); - reply_builder = reply_builder.priority(Priority::try_from(qos_priority as u8).unwrap()); // The numeric value is always within range. - reply_builder = if qos_congestion_control != 0 { - reply_builder.congestion_control(CongestionControl::Block) - } else { - reply_builder.congestion_control(CongestionControl::Drop) - }; reply_builder.wait().map_err(|err| zerror!(err)) }() .map_err(|err| throw_exception!(env, err)); @@ -173,8 +164,6 @@ pub(crate) unsafe extern "C" fn Java_io_zenoh_jni_JNIQuery_replyDeleteViaJNI( timestamp_ntp_64: jlong, attachment: /*nullable*/ JByteArray, qos_express: jboolean, - qos_priority: jint, - qos_congestion_control: jint, ) { let _ = || -> ZResult<()> { let query = Arc::from_raw(query_ptr); @@ -188,12 +177,6 @@ pub(crate) unsafe extern "C" fn Java_io_zenoh_jni_JNIQuery_replyDeleteViaJNI( reply_builder = reply_builder.attachment(decode_byte_array(&env, attachment)?); } reply_builder = reply_builder.express(qos_express != 0); - reply_builder = reply_builder.priority(Priority::try_from(qos_priority as u8).unwrap()); // The numeric value is always within range. - reply_builder = if qos_congestion_control != 0 { - reply_builder.congestion_control(CongestionControl::Block) - } else { - reply_builder.congestion_control(CongestionControl::Drop) - }; reply_builder.wait().map_err(|err| zerror!(err)) }() .map_err(|err| throw_exception!(env, err)); From 44ff769a5be8cb505680dc64d17a38b6adc0e491 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Fri, 6 Mar 2026 11:48:20 +0000 Subject: [PATCH 3/3] chore: remove branch placeholder zbobr_fix-34-fix-issue-428 --- .zbobr/zbobr_fix-34-fix-issue-428 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .zbobr/zbobr_fix-34-fix-issue-428 diff --git a/.zbobr/zbobr_fix-34-fix-issue-428 b/.zbobr/zbobr_fix-34-fix-issue-428 deleted file mode 100644 index e69de29..0000000