-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-1174 Add support for configurable Message conversion helper
This commit includes only the interfaces and interaction callbacks. The rest of the implementation is provided by binders in s-c-stream
- Loading branch information
Showing
5 changed files
with
87 additions
and
5 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
46 changes: 46 additions & 0 deletions
46
...c/main/java/org/springframework/cloud/function/context/config/MessageConverterHelper.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,46 @@ | ||
/* | ||
* Copyright 2015-2021 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.cloud.function.context.config; | ||
|
||
import org.springframework.messaging.Message; | ||
|
||
/** | ||
* @author Oleg Zhurakousky | ||
*/ | ||
public interface MessageConverterHelper { | ||
|
||
/** | ||
* This method will be called by the framework in cases when a message failed to convert. | ||
* It allows you to signal to the framework if such failure should be considered fatal or not. | ||
* | ||
* @param message failed message | ||
* @return true if conversion failure must be considered fatal. | ||
*/ | ||
default boolean shouldFailIfCantConvert(Message<?> message) { | ||
return false; | ||
} | ||
|
||
/** | ||
* This method will be called by the framework in cases when a single message within batch of messages failed to convert. | ||
* It provides a place for providing post-processing logic before message converter returns. | ||
* | ||
* @param message failed message. | ||
* @param index index of failed message within the batch | ||
*/ | ||
default void postProcessBatchMessageOnFailure(Message<?> message, int index) { | ||
} | ||
} |
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