This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use MessageWrapper to sync acknowledge and timeout extender
- Loading branch information
Stephan.Praetsch
committed
Jun 10, 2024
1 parent
c746611
commit 61fdc3a
Showing
11 changed files
with
101 additions
and
150 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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/mercateo/sqs/utils/message/handling/MessageWrapper.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,42 @@ | ||
package com.mercateo.sqs.utils.message.handling; | ||
|
||
import io.awspring.cloud.messaging.listener.Acknowledgment; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import org.springframework.messaging.Message; | ||
|
||
@RequiredArgsConstructor | ||
public class MessageWrapper<I> { | ||
|
||
@NonNull | ||
@Getter | ||
private final Message<I> message; | ||
|
||
private final AtomicBoolean acknowledged = new AtomicBoolean(false); | ||
|
||
public void acknowledge() { | ||
acknowledged.set(true); | ||
} | ||
|
||
public boolean isAcknowledged() { | ||
return acknowledged.get(); | ||
} | ||
|
||
public String getMessageId() { | ||
return message.getHeaders().get("MessageId", String.class); | ||
} | ||
|
||
public String getReceiptHandle() { | ||
return message.getHeaders().get("ReceiptHandle", String.class); | ||
} | ||
|
||
public Acknowledgment getAcknowledgment() { | ||
return message.getHeaders().get("Acknowledgment", Acknowledgment.class); | ||
} | ||
|
||
} |
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
31 changes: 0 additions & 31 deletions
31
...test/java/com/mercateo/sqs/utils/message/handling/MessageHandlingRunnableFactoryTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.