-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-2994: Add
RabbitAmqpListenerContainer
infrastructure
Related to: #2994 * Add `RabbitAmqpMessageListener` for RabbitMQ AMQP 1.0 native message consumption * Add `RabbitAmqpMessageListenerAdapter` for `@RabbitLister` API * Add `RabbitAmqpListenerContainer` and respective `RabbitAmqpListenerContainerFactory` * Add `AmqpAcknowledgment` as a general abstraction. In the `RabbitAmqpListenerContainer` delegates to the `Consumer.Context` for manual settlement * Extract `RabbitAmqpUtils` for conversion to/from AMQP 1.0 native message * Add convenient `ContainerUtils.isImmediateAcknowledge()` and `ContainerUtils.isAmqpReject()` utilities * Expose `AmqpAcknowledgment` as a `MessageProperties.amqpAcknowledgment` for generic `MessageListener` use-cases * Remove `io.micrometer` dependecies from the `spring-rabbitmq-client` module since metrics and observation handled thoroughly in the `com.rabbitmq.client:amqp-client` Not tests for the listener yet. Therefore no fixing for the issue.
- Loading branch information
1 parent
6f0a338
commit 5be96cb
Showing
13 changed files
with
888 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
spring-amqp/src/main/java/org/springframework/amqp/core/AmqpAcknowledgment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2025 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.amqp.core; | ||
|
||
/** | ||
* An abstraction over acknowledgments. | ||
* | ||
* @author Artem Bilan | ||
* | ||
* @since 4.0 | ||
*/ | ||
@FunctionalInterface | ||
public interface AmqpAcknowledgment { | ||
|
||
/** | ||
* Acknowledge the message. | ||
* @param status the status. | ||
*/ | ||
void acknowledge(Status status); | ||
|
||
default void acknowledge() { | ||
acknowledge(Status.ACCEPT); | ||
} | ||
|
||
enum Status { | ||
|
||
/** | ||
* Mark the message as accepted. | ||
*/ | ||
ACCEPT, | ||
|
||
/** | ||
* Mark the message as rejected. | ||
*/ | ||
REJECT, | ||
|
||
/** | ||
* Reject the message and requeue so that it will be redelivered. | ||
*/ | ||
REQUEUE | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.