Introduce IntegrationPattern abstraction
* Add `IntegrationPattern` contract to implement on the target components which represent particular EIP * Add `IntegrationPatternType` with an internal `IntegrationPatternCategory` to return from the component implementing `IntegrationPattern` * Parse `IntegrationPatternType` in the `IntegrationNode` for potential use on the UI for drawing a particular icon * More pattern representations * Clean up Checkstyle * Fix JavaDocs * Add `integrationPatternCategory` assertion into the `IntegrationGraphServerTests` * Add more IntegrationPattern implementations * Provide some delegation and overriding logic whenever we have components wrapping * Fix unused imports * Add `inbound_gateway` pattern indicator * Add conditional on `expectReply` to indicate a component as an `IntegrationPatternType.outbound_channel_adapter` or `IntegrationPatternType.outbound_gateway` * Make some code clean up in affected classes * Add a `gateway` type for `@MessagingGateway` * Comment the reason for `outbound_gateway` type in the `AbstractReplyProducingMessageHandler` * Bump `IntegrationGraphServer.GRAPH_VERSION` * Add new attributes into graph sample in the `graph.adoc` * Document an `IntegrationPattern` * Apply changes for version 5.3 * Rebased into `5.3-WIP` * Add a `whats-new.adoc` note about an `IntegrationPattern`
This commit is contained in:
@@ -49,6 +49,7 @@ import org.springframework.context.Lifecycle;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.IntegrationPatternType;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.file.support.FileExistsMode;
|
||||
import org.springframework.integration.file.support.FileUtils;
|
||||
@@ -302,7 +303,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
|
||||
*/
|
||||
public void setCharset(String charset) {
|
||||
Assert.notNull(charset, "charset must not be null");
|
||||
Assert.isTrue(Charset.isSupported(charset), "Charset '" + charset + "' is not supported.");
|
||||
Assert.isTrue(Charset.isSupported(charset), () -> "Charset '" + charset + "' is not supported.");
|
||||
this.charset = Charset.forName(charset);
|
||||
}
|
||||
|
||||
@@ -412,6 +413,16 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
|
||||
this.newFileCallback = newFileCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return this.expectReply ? "file:outbound-gateway" : "file:outbound-channel-adapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegrationPatternType getIntegrationPatternType() {
|
||||
return this.expectReply ? super.getIntegrationPatternType() : IntegrationPatternType.outbound_channel_adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doInit() {
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
|
||||
@@ -548,7 +559,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
|
||||
private File writeMessageToFile(Message<?> requestMessage, File originalFileFromHeader, File tempFile,
|
||||
File resultFile, Object timestamp) throws IOException {
|
||||
|
||||
File fileToReturn = null;
|
||||
File fileToReturn;
|
||||
Object payload = requestMessage.getPayload();
|
||||
if (payload instanceof File) {
|
||||
fileToReturn = handleFileMessage((File) payload, tempFile, resultFile, requestMessage);
|
||||
|
||||
Reference in New Issue
Block a user