GH-7: Add checkstyle and javaformat plugins
Fixes: #7 * Run `./gradlew format` * Updates from PR review suggestions
This commit is contained in:
@@ -63,17 +63,11 @@ public class AggregatorFunctionConfiguration {
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Message<?>>, Flux<Message<?>>> aggregatorFunction(
|
||||
FluxMessageChannel inputChannel,
|
||||
FluxMessageChannel outputChannel
|
||||
) {
|
||||
public Function<Flux<Message<?>>, Flux<Message<?>>> aggregatorFunction(FluxMessageChannel inputChannel,
|
||||
FluxMessageChannel outputChannel) {
|
||||
return input -> Flux.from(outputChannel)
|
||||
.doOnRequest((request) ->
|
||||
inputChannel.subscribeTo(
|
||||
input.map((inputMessage) ->
|
||||
MessageBuilder.fromMessage(inputMessage)
|
||||
.removeHeader("kafka_consumer")
|
||||
.build())));
|
||||
.doOnRequest((request) -> inputChannel.subscribeTo(input.map((
|
||||
inputMessage) -> MessageBuilder.fromMessage(inputMessage).removeHeader("kafka_consumer").build())));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -88,13 +82,10 @@ public class AggregatorFunctionConfiguration {
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "inputChannel")
|
||||
public AggregatorFactoryBean aggregator(
|
||||
@Nullable CorrelationStrategy correlationStrategy,
|
||||
@Nullable ReleaseStrategy releaseStrategy,
|
||||
@Nullable MessageGroupProcessor messageGroupProcessor,
|
||||
@Nullable MessageGroupStore messageStore,
|
||||
@Qualifier("outputChannel") MessageChannel outputChannel,
|
||||
@Nullable ComponentCustomizer<AggregatorFactoryBean> aggregatorCustomizer) {
|
||||
public AggregatorFactoryBean aggregator(@Nullable CorrelationStrategy correlationStrategy,
|
||||
@Nullable ReleaseStrategy releaseStrategy, @Nullable MessageGroupProcessor messageGroupProcessor,
|
||||
@Nullable MessageGroupStore messageStore, @Qualifier("outputChannel") MessageChannel outputChannel,
|
||||
@Nullable ComponentCustomizer<AggregatorFactoryBean> aggregatorCustomizer) {
|
||||
|
||||
AggregatorFactoryBean aggregator = new AggregatorFactoryBean();
|
||||
aggregator.setExpireGroupsUponCompletion(true);
|
||||
@@ -149,14 +140,10 @@ public class AggregatorFunctionConfiguration {
|
||||
return new ExpressionEvaluatingMessageGroupProcessor(this.properties.getAggregation().getExpressionString());
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(MessageGroupStore.class)
|
||||
@Import({
|
||||
MessageStoreConfiguration.Mongo.class,
|
||||
MessageStoreConfiguration.Redis.class,
|
||||
MessageStoreConfiguration.Jdbc.class
|
||||
})
|
||||
@Import({ MessageStoreConfiguration.Mongo.class, MessageStoreConfiguration.Redis.class,
|
||||
MessageStoreConfiguration.Jdbc.class })
|
||||
protected static class MessageStoreAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ public class AggregatorFunctionProperties {
|
||||
private String messageStoreType = MessageStoreType.SIMPLE;
|
||||
|
||||
/**
|
||||
* Persistence message store entity: table prefix in RDBMS, collection name in MongoDb, etc.
|
||||
* Persistence message store entity: table prefix in RDBMS, collection name in
|
||||
* MongoDb, etc.
|
||||
*/
|
||||
private String messageStoreEntity;
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
|
||||
/**
|
||||
* An {@link EnvironmentPostProcessor} to add {@code spring.autoconfigure.exclude} property
|
||||
* since we can't use {@code application.properties} from the library perspective.
|
||||
* An {@link EnvironmentPostProcessor} to add {@code spring.autoconfigure.exclude}
|
||||
* property since we can't use {@code application.properties} from the library
|
||||
* perspective.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Corneil du Plessis
|
||||
@@ -45,16 +46,14 @@ public class ExcludeStoresAutoConfigurationEnvironmentPostProcessor implements E
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
Properties properties = new Properties();
|
||||
|
||||
properties.setProperty("spring.autoconfigure.exclude",
|
||||
DataSourceAutoConfiguration.class.getName() + ", " +
|
||||
DataSourceTransactionManagerAutoConfiguration.class.getName() + ", " +
|
||||
MongoAutoConfiguration.class.getName() + ", " +
|
||||
MongoDataAutoConfiguration.class.getName() + ", " +
|
||||
MongoRepositoriesAutoConfiguration.class.getName() + ", " +
|
||||
RedisAutoConfiguration.class.getName() + ", " +
|
||||
RedisRepositoriesAutoConfiguration.class.getName());
|
||||
properties.setProperty("spring.autoconfigure.exclude", DataSourceAutoConfiguration.class.getName() + ", "
|
||||
+ DataSourceTransactionManagerAutoConfiguration.class.getName() + ", "
|
||||
+ MongoAutoConfiguration.class.getName() + ", " + MongoDataAutoConfiguration.class.getName() + ", "
|
||||
+ MongoRepositoriesAutoConfiguration.class.getName() + ", " + RedisAutoConfiguration.class.getName()
|
||||
+ ", " + RedisRepositoriesAutoConfiguration.class.getName());
|
||||
|
||||
propertySources.addLast(new PropertiesPropertySource("aggregator.exclude.stores.auto-configuration", properties));
|
||||
propertySources
|
||||
.addLast(new PropertiesPropertySource("aggregator.exclude.stores.auto-configuration", properties));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,11 +40,10 @@ import org.springframework.integration.store.MessageGroupStore;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* A helper class containing configuration classes for particular technologies
|
||||
* to expose an appropriate {@link org.springframework.integration.store.MessageStore} bean
|
||||
* via matched configuration properties.
|
||||
* A helper class containing configuration classes for particular technologies to expose
|
||||
* an appropriate {@link org.springframework.integration.store.MessageStore} bean via
|
||||
* matched configuration properties.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Corneil du Plessis
|
||||
@@ -52,11 +51,9 @@ import org.springframework.util.StringUtils;
|
||||
class MessageStoreConfiguration {
|
||||
|
||||
@ConditionalOnClass(ConfigurableMongoDbMessageStore.class)
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX,
|
||||
name = "message-store-type",
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX, name = "message-store-type",
|
||||
havingValue = AggregatorFunctionProperties.MessageStoreType.MONGODB)
|
||||
@Import({ MongoAutoConfiguration.class,
|
||||
MongoDataAutoConfiguration.class })
|
||||
@Import({ MongoAutoConfiguration.class, MongoDataAutoConfiguration.class })
|
||||
static class Mongo {
|
||||
|
||||
@Bean
|
||||
@@ -72,15 +69,14 @@ class MessageStoreConfiguration {
|
||||
@Bean
|
||||
@Primary
|
||||
public MongoCustomConversions mongoDbCustomConversions() {
|
||||
return new MongoCustomConversions(Arrays.asList(
|
||||
new MessageToBinaryConverter(), new BinaryToMessageConverter()));
|
||||
return new MongoCustomConversions(
|
||||
Arrays.asList(new MessageToBinaryConverter(), new BinaryToMessageConverter()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ConditionalOnClass(RedisMessageStore.class)
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX,
|
||||
name = "message-store-type",
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX, name = "message-store-type",
|
||||
havingValue = AggregatorFunctionProperties.MessageStoreType.REDIS)
|
||||
@Import(RedisAutoConfiguration.class)
|
||||
static class Redis {
|
||||
@@ -93,12 +89,9 @@ class MessageStoreConfiguration {
|
||||
}
|
||||
|
||||
@ConditionalOnClass(JdbcMessageStore.class)
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX,
|
||||
name = "message-store-type",
|
||||
@ConditionalOnProperty(prefix = AggregatorFunctionProperties.PREFIX, name = "message-store-type",
|
||||
havingValue = AggregatorFunctionProperties.MessageStoreType.JDBC)
|
||||
@Import({
|
||||
DataSourceAutoConfiguration.class,
|
||||
DataSourceTransactionManagerAutoConfiguration.class })
|
||||
@Import({ DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })
|
||||
static class Jdbc {
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user