Remove ChannelBindingAdapterRunner
- Since `ChannelBindingAdapter` implements `SmartLifecycle`, it is expected to start with the highest precedence when the lifecycle beans are started.
- Remove `autoStartup` from `ChannelBindingProperties`
- This property was used by the CBARunner to start the CBA if autoStartup is true
- Since all the lifecycle beans (inbound/outbound channel adapters) are started with appropriate phase and autoStartup flag the ChannelBindingProperties's autoStartup isn't needed.
This commit is contained in:
@@ -25,7 +25,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.cloud.stream.config.AggregateBuilderConfiguration;
|
||||
import org.springframework.cloud.stream.config.ChannelBindingAdapterConfiguration;
|
||||
import org.springframework.cloud.stream.config.ChannelBindingAdapterRunner;
|
||||
import org.springframework.cloud.stream.config.ModuleRegistrar;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -43,8 +42,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Inherited
|
||||
@Configuration
|
||||
@Import({
|
||||
ChannelBindingAdapterConfiguration.class, ChannelBindingAdapterRunner.class,
|
||||
AggregateBuilderConfiguration.class, ModuleRegistrar.class})
|
||||
ChannelBindingAdapterConfiguration.class, AggregateBuilderConfiguration.class, ModuleRegistrar.class})
|
||||
public @interface EnableModule {
|
||||
|
||||
Class<?>[] value() default {};
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.cloud.stream.adapter.ChannelBindingAdapter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ChannelBindingAdapterRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private ChannelBindingProperties module;
|
||||
|
||||
@Autowired
|
||||
private ChannelBindingAdapter adapter;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
if (!adapter.isRunning() && module.isAutoStartup()) {
|
||||
adapter.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,6 @@ public class ChannelBindingProperties {
|
||||
|
||||
private Properties producerProperties = new Properties();
|
||||
|
||||
private boolean autoStartup = true;
|
||||
|
||||
private Map<String,Object> bindings = new HashMap<>();
|
||||
|
||||
public Properties getConsumerProperties() {
|
||||
@@ -59,14 +57,6 @@ public class ChannelBindingProperties {
|
||||
this.producerProperties = producerProperties;
|
||||
}
|
||||
|
||||
public boolean isAutoStartup() {
|
||||
return this.autoStartup;
|
||||
}
|
||||
|
||||
public void setAutoStartup(boolean autoStartup) {
|
||||
this.autoStartup = autoStartup;
|
||||
}
|
||||
|
||||
public Map<String, Object> getBindings() {
|
||||
return bindings;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user