-
Notifications
You must be signed in to change notification settings - Fork 644
removed spring-xd-dirt dependencies #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...main/java/org/springframework/xd/dirt/integration/bus/MessageBusAwareChannelResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Copyright 2013-2014 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.xd.dirt.integration.bus; | ||
|
|
||
| import java.util.Properties; | ||
|
|
||
| import org.springframework.messaging.MessageChannel; | ||
| import org.springframework.messaging.core.BeanFactoryMessageChannelDestinationResolver; | ||
| import org.springframework.messaging.core.DestinationResolutionException; | ||
|
|
||
| /** | ||
| * A {@link org.springframework.messaging.core.DestinationResolver} implementation that first checks for any channel | ||
| * whose name begins with a colon in the {@link MessageBus}. | ||
| * | ||
| * @author Mark Fisher | ||
| * @author Gary Russell | ||
| */ | ||
| public class MessageBusAwareChannelResolver extends BeanFactoryMessageChannelDestinationResolver { | ||
|
|
||
| private final MessageBus messageBus; | ||
|
|
||
| private final Properties producerProperties; | ||
|
|
||
| public MessageBusAwareChannelResolver(MessageBus messageBus, Properties producerProperties) { | ||
| this.messageBus = messageBus; | ||
| this.producerProperties = producerProperties; | ||
| } | ||
|
|
||
| @Override | ||
| public MessageChannel resolveDestination(String name) { | ||
| MessageChannel channel = null; | ||
| try { | ||
| return super.resolveDestination(name); | ||
| } | ||
| catch (DestinationResolutionException e) { | ||
| } | ||
| if (name.indexOf(":") != -1) { | ||
| if (messageBus != null) { | ||
| String[] tokens = name.split(":", 2); | ||
| String type = tokens[0]; | ||
| if ("queue".equals(type)) { | ||
| channel = this.messageBus.bindDynamicProducer(name, this.producerProperties); | ||
| } | ||
| else if ("topic".equals(type)) { | ||
| channel = this.messageBus.bindDynamicPubSubProducer(name, this.producerProperties); | ||
| } | ||
| else { | ||
| throw new IllegalArgumentException("unrecognized channel type: " + type); | ||
| } | ||
| } | ||
| } | ||
| if (channel == null) { | ||
| channel = super.resolveDestination(name); | ||
| } | ||
| return channel; | ||
| } | ||
|
|
||
| } |
60 changes: 60 additions & 0 deletions
60
...a/org/springframework/xd/dirt/integration/bus/MessageBusAwareRouterBeanPostProcessor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright 2013-2014 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.xd.dirt.integration.bus; | ||
|
|
||
| import java.util.Properties; | ||
|
|
||
| import org.springframework.beans.BeansException; | ||
| import org.springframework.beans.factory.BeanFactory; | ||
| import org.springframework.beans.factory.BeanFactoryAware; | ||
| import org.springframework.beans.factory.config.BeanPostProcessor; | ||
| import org.springframework.integration.router.AbstractMappingMessageRouter; | ||
|
|
||
| /** | ||
| * A {@link BeanPostProcessor} that sets a {@link MessageBusAwareChannelResolver} on any bean of type | ||
| * {@link AbstractMappingMessageRouter} within the context. | ||
| * | ||
| * @author Mark Fisher | ||
| * @author Gary Russell | ||
| */ | ||
| public class MessageBusAwareRouterBeanPostProcessor implements BeanPostProcessor, BeanFactoryAware { | ||
|
|
||
| private final MessageBusAwareChannelResolver channelResolver; | ||
|
|
||
| public MessageBusAwareRouterBeanPostProcessor(MessageBus messageBus, Properties producerProperties) { | ||
| this.channelResolver = new MessageBusAwareChannelResolver(messageBus, producerProperties); | ||
| } | ||
|
|
||
| @Override | ||
| public void setBeanFactory(BeanFactory beanFactory) throws BeansException { | ||
| channelResolver.setBeanFactory(beanFactory); | ||
| } | ||
|
|
||
| @Override | ||
| public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { | ||
| return bean; | ||
| } | ||
|
|
||
| @Override | ||
| public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { | ||
| if (bean instanceof AbstractMappingMessageRouter) { | ||
| ((AbstractMappingMessageRouter) bean).setChannelResolver(channelResolver); | ||
| } | ||
| return bean; | ||
| } | ||
|
|
||
| } |
26 changes: 26 additions & 0 deletions
26
spring-cloud-streams/src/main/resources/META-INF/spring-bus/codec.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <beans xmlns="http://www.springframework.org/schema/beans" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
|
|
||
| <bean id="codec" class="org.springframework.xd.dirt.integration.bus.serializer.CompositeCodec"> | ||
| <constructor-arg name="delegates"> | ||
| <map> | ||
| <!-- pulls in spring-xd-tuple --> | ||
| <!--<entry key="org.springframework.xd.tuple.Tuple">--> | ||
| <!--<bean class="org.springframework.xd.tuple.serializer.kryo.TupleCodec"/>--> | ||
| <!--</entry>--> | ||
| <entry key="java.io.File"> | ||
| <bean class="org.springframework.xd.dirt.integration.bus.serializer.kryo.FileCodec"/> | ||
| </entry> | ||
| </map> | ||
| </constructor-arg> | ||
| <constructor-arg name="defaultCodec" ref="defaultCodec"/> | ||
| </bean> | ||
|
|
||
| <bean id="defaultCodec" class="org.springframework.xd.dirt.integration.bus.serializer.kryo.PojoCodec"> | ||
| <constructor-arg ref="kryoRegistrar"/> | ||
| </bean> | ||
|
|
||
| <bean id="kryoRegistrar" class="org.springframework.xd.dirt.integration.bus.serializer.kryo.KryoNullRegistrar"/> | ||
| </beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note for later: we should change the spring-bus directory name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the XML config goes away. It's been removed from XD already. The Rabbit and Redis MB configurations are XML that have I would like to get rid of the magic bean name and Autowire by type instead. Then it should be a matter of adding a jar that provides an implementation of MultitypeCodec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made
spring-bus -> spring-cloud-streams. The XML should probably go away as well.