Skip to content

Commit 0435d18

Browse files
author
Scott Gerring
committed
Add extra bit for handling message-specific mutation
1 parent 5469287 commit 0435d18

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

powertools-batch/src/main/java/software/amazon/lambda/powertools/batch/BatchRequestHandler.java

+10
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public V handleRequest(T input, Context context) {
5252
// For each message, map it to either 1/ a successful result, or 2/ an exception
5353
List<MessageProcessingResult<U>> results = messages.stream().map(m -> {
5454
try {
55+
enhanceMessage(m);
5556
processItem(m, context);
5657
return new MessageProcessingResult<>(m, null);
5758
} catch (Exception e) {
@@ -87,4 +88,13 @@ public V handleRequest(T input, Context context) {
8788
* @param context
8889
*/
8990
public abstract void processItem(U message, Context context);
91+
92+
/**
93+
* This could be overriden by event-specific children to implement things like large
94+
* message processing.
95+
* @param message
96+
*/
97+
protected void enhanceMessage(U message) {
98+
99+
}
90100
}

0 commit comments

Comments
 (0)