GH-2100: logging-adapter.adoc: Remove channel

Fixes spring-projects/spring-integration#2100

Also add a sample how to configure logging channel adapter from Java DSL
This commit is contained in:
Rob Moore
2017-03-24 14:07:42 -05:00
committed by Artem Bilan
parent f347b2499e
commit 970854fd6f

View File

@@ -58,11 +58,6 @@ public class LoggingJavaApplication {
gateway.sendToLogger("foo");
}
@Bean
public MessageChannel logInputChannel() {
return new DirectChannel();
}
@Bean
@ServiceActivator(inputChannel = "logChannel")
public LoggingHandler logging() {
@@ -81,3 +76,38 @@ public class LoggingJavaApplication {
}
----
==== Configuring with the Java DSL
The following Spring Boot application provides an example of configuring the logging channel adapter using the Java DSL:
[source, java]
----
@SpringBootApplication
public class LoggingJavaApplication {
public static void main(String[] args) {
ConfigurableApplicationContext context =
new SpringApplicationBuilder(LoggingJavaApplication.class)
.web(false)
.run(args);
MyGateway gateway = context.getBean(MyGateway.class);
gateway.sendToLogger("foo");
}
@Bean
public IntegrationFlow loggingFlow() {
return IntegrationFlows.from(MyGateway.class)
.log(LoggingHandler.Level.DEBUG, "TEST_LOGGER",
m -> m.getHeaders().getId() + ": " + m.getPayload());
}
@MessagingGateway
public interface MyGateway {
void sendToLogger(String data);
}
}
----