IntegrationFlow: optional @MessagingGateway
When we use `IntegrationFlows.from(Class<?>)`, we don't need to require present for `@MessagingGateway`, we can just synthesize it with the default properties This way we can simply make gateway proxies for the `java.util.function` interfaces which should be useful for Spring Cloud Function
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
@@ -423,11 +424,11 @@ public class IntegrationFlowTests {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ErrorRecovererFlowGateway errorRecovererFlowGateway;
|
||||
private Function<String, String> errorRecovererFlowGateway;
|
||||
|
||||
@Test
|
||||
public void testReplyChannelFromReplyMessage() {
|
||||
assertEquals("foo", this.errorRecovererFlowGateway.testIt("foo"));
|
||||
assertEquals("foo", this.errorRecovererFlowGateway.apply("foo"));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -719,7 +720,7 @@ public class IntegrationFlowTests {
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow errorRecovererFlow() {
|
||||
return IntegrationFlows.from(ErrorRecovererFlowGateway.class)
|
||||
return IntegrationFlows.from(Function.class)
|
||||
.handle((GenericHandler<?>) (p, h) -> {
|
||||
throw new RuntimeException("intentional");
|
||||
}, e -> e.advice(retryAdvice()))
|
||||
@@ -764,13 +765,6 @@ public class IntegrationFlowTests {
|
||||
|
||||
}
|
||||
|
||||
@MessagingGateway
|
||||
private interface ErrorRecovererFlowGateway {
|
||||
|
||||
String testIt(String payload);
|
||||
|
||||
}
|
||||
|
||||
@Service
|
||||
public static class GreetingService extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user