Support flexible bound element types
Fixes #519 Introduces some internal changes to the framework allowing the use of other types than MessageChannel/SubscribableChannel as bindable types (e.g. Flux, Observable, KStream, etc.) - Modify BinderFactory to allow the retrieval and lookup of a binder not only by name, but also by binding target type - Subsequent changes to ChannelBindingService and tests to account for the modified signature - Introduce BindingTargetFactory as the contract for creating bound elements - Remove any references to chanels and bound elements and use 'binding target' systematically across the board Reinstate our own Checkstyle checks with a reduced set of rules so that header validation can be performed automatically at compile time. Use ${project.version} for the checkstyle plugin configuration Renaming some occurences of 'boundElement' to 'bindingTarget' Renamed a stray occurence of 'channel' Fix some occurences of String concatenation in the same line after reformatting
This commit is contained in:
committed by
markfisher
parent
8e5689c298
commit
8ac71c7b57
@@ -19,6 +19,8 @@ package org.springframework.cloud.stream.test.binder;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.BinderFactory;
|
||||
import org.springframework.cloud.stream.binder.ConsumerProperties;
|
||||
import org.springframework.cloud.stream.binder.ProducerProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -45,15 +47,15 @@ public class TestSupportBinderAutoConfiguration {
|
||||
public BinderFactory binderFactory() {
|
||||
return new BinderFactory() {
|
||||
@Override
|
||||
public Binder getBinder(String configurationName) {
|
||||
return messageChannelBinder;
|
||||
public <T> Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties> getBinder(String configurationName, Class<? extends T> bindableType) {
|
||||
return (Binder<T, ? extends ConsumerProperties, ? extends ProducerProperties>) messageChannelBinder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageCollector messageCollector(BinderFactory<MessageChannel> binderFactory) {
|
||||
return ((TestSupportBinder) binderFactory.getBinder(null)).messageCollector();
|
||||
public MessageCollector messageCollector(BinderFactory binderFactory) {
|
||||
return ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class)).messageCollector();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2016 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.test.aggregate;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2016 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.test.aggregate;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.springframework.cloud.stream.messaging.Processor;
|
||||
import org.springframework.cloud.stream.test.binder.MessageCollector;
|
||||
import org.springframework.integration.annotation.Transformer;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -46,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class ExampleTest {
|
||||
|
||||
@Autowired
|
||||
private BinderFactory<MessageChannel> binderFactory;
|
||||
private BinderFactory binderFactory;
|
||||
|
||||
@Autowired
|
||||
private MessageCollector messageCollector;
|
||||
|
||||
Reference in New Issue
Block a user