import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ImportResource;
+ import org.springframework.expression.Expression;
+ import org.springframework.expression.ExpressionParser;
import org.springframework.expression.common.LiteralExpression;
+ import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.config.EnableIntegration;
@SpringBootApplication
@EnableConfigurationProperties(SplitterApplicationProperties.class)
@EnableIntegration
+@ImportResource("classpath:integration.xml")
public class SplitterApplication
{
- @Bean
- ChannelInterceptor keyInterceptor ()
- {
- return new ChannelInterceptor()
- {
- @Override
- public Message<?> preSend(Message<?> message, MessageChannel channel)
- {
- MessageHeaders headers = message.getHeaders();
- Object key = headers.get(KafkaHeaders.RECEIVED_MESSAGE_KEY);
- return
- MessageBuilder
- .fromMessage(message)
- .setHeader(KafkaHeaders.MESSAGE_KEY, key)
- .build();
- }
- };
- }
-
@InboundChannelAdapter(channel = "recordings")
@Bean
KafkaMessageSource<String, String> source(
--- /dev/null
- xmlns:int="http://www.springframework.org/schema/integration"
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd">
-
- <int:channel id="words">
- <int:interceptors>
- <ref bean="keyInterceptor"/>
- </int:interceptors>
- </int:channel>
+ xsi:schemaLocation="
++ http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
+
+</beans>