Skip to content

Commit 06e34cc

Browse files
authored
Merge pull request #135 from rabbitmq/range-disposition
Start support for disposition frame with ranges
2 parents a2b1e37 + df68350 commit 06e34cc

21 files changed

+1476
-94
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@
266266
<scope>test</scope>
267267
</dependency>
268268

269+
<dependency>
270+
<groupId>io.dropwizard.metrics</groupId>
271+
<artifactId>metrics-core</artifactId>
272+
<version>4.2.29</version>
273+
<scope>test</scope>
274+
</dependency>
275+
269276
</dependencies>
270277

271278
<dependencyManagement>
@@ -490,6 +497,7 @@
490497
<configuration>
491498
<java>
492499
<excludes>
500+
<exclude>src/main/java/com/rabbitmq/client/amqp/impl/FastUtil*.java</exclude>
493501
<exclude>src/test/java/com/rabbitmq/client/amqp/docs/*.java</exclude>
494502
<exclude>src/test/java/SanityCheck.java</exclude>
495503
</excludes>

src/docs/asciidoc/usage.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ include::{test-examples}/Api.java[tag=connection-settings]
2626
<1> Use the `guest` user by default
2727
<2> Use the `admin` user for this connection
2828

29+
=== Settling Messages in Batch
30+
31+
.Settling messages in batch
32+
[source,java,indent=0]
33+
--------
34+
include::{test-examples}/Api.java[tag=settling-message-in-batch]
35+
--------
36+
<1> Declare batch context property
37+
<2> Create a new batch context instance
38+
<3> Add the current message context to the batch context if processing is successful
39+
<4> Settle the batch context once it contains 10 messages
40+
<5> Reset the batch context
41+
<6> Discard the current message context if processing fails
42+
43+
2944
=== Subscription Listener
3045

3146
The client provides a `SubscriptionListener` interface callback to add behavior before a subscription is created.

src/main/java/com/rabbitmq/client/amqp/Consumer.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,45 @@ interface Context {
134134
* in RabbitMQ</a>
135135
*/
136136
void requeue(Map<String, Object> annotations);
137+
138+
/**
139+
* Create a batch context to accumulate message contexts and settle them at once.
140+
*
141+
* <p>The message context the batch context is created from is <b>not</b> added to the batch
142+
* context.
143+
*
144+
* @return the created batch context
145+
*/
146+
BatchContext batch(int batchSizeHint);
147+
}
148+
149+
/**
150+
* Context to accumulate message contexts and settle them at once.
151+
*
152+
* <p>A {@link BatchContext} is also a {@link Context}: the same methods are available to settle
153+
* the messages.
154+
*
155+
* <p>Only "simple" (not batch) message contexts can be added to a batch context. Calling {@link
156+
* Context#batch()} on a batch context returns the instance itself.
157+
*
158+
* @see <a
159+
* href="https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-disposition">AMQP
160+
* 1.0 Disposition performative</a>
161+
*/
162+
interface BatchContext extends Context {
163+
164+
/**
165+
* Add a message context to the batch context.
166+
*
167+
* @param context the message context to add
168+
*/
169+
void add(Context context);
170+
171+
/**
172+
* Get the current number of message contexts in the batch context.
173+
*
174+
* @return current number of message contexts in the batch
175+
*/
176+
int size();
137177
}
138178
}

0 commit comments

Comments
 (0)