Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 37 additions & 75 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<java.version>1.7</java.version>
<spring-boot.version>1.3.0.BUILD-SNAPSHOT</spring-boot.version>
<spring-cloud.version>Brixton.BUILD-SNAPSHOT</spring-cloud.version>
<spring-xd.version>2.0.0.BUILD-SNAPSHOT</spring-xd.version>
</properties>
<properties>
<java.version>1.7</java.version>
<spring-boot.version>1.3.0.BUILD-SNAPSHOT</spring-boot.version>
<spring-cloud.version>Brixton.BUILD-SNAPSHOT</spring-cloud.version>
<spring-xd.version>2.0.0.BUILD-SNAPSHOT</spring-xd.version>
<spring-framework.version>4.2.0.RC2</spring-framework.version>
</properties>
<modules>
<module>spring-cloud-streams</module>
<module>spring-xd-runner</module>
Expand Down Expand Up @@ -47,75 +48,36 @@
<artifactId>spring-xd-runner</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-dirt</artifactId>
<version>${spring-xd.version}</version>
<exclusions>
<exclusion>
<artifactId>jackson-core-asl</artifactId>
<groupId>org.codehaus.jackson</groupId>
</exclusion>
<exclusion>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-spark-streaming</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-hadoop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-batch</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-ui</artifactId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>zookeeper</artifactId>
<groupId>org.apache.zookeeper</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-security</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-security-ldap</artifactId>
<groupId>org.springframework.security</groupId>
</exclusion>
<exclusion>
<artifactId>spring-jdbc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-batch-integration</artifactId>
<groupId>org.springframework.batch</groupId>
</exclusion>
<exclusion>
<artifactId>spring-batch-admin-manager</artifactId>
<groupId>org.springframework.batch</groupId>
</exclusion>
<exclusion>
<artifactId>spring-data-mongodb</artifactId>
<groupId>org.springframework.data</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-redis</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-rabbit</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-codec</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-module</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-local</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-redis</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-rabbit</artifactId>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${spring-framework.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down
25 changes: 24 additions & 1 deletion spring-cloud-streams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,33 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-codec</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-module</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-dirt</artifactId>
<artifactId>spring-xd-messagebus-local</artifactId>
</dependency>



<dependency>
<groupId>org.springframework.xd</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*
*/
@Configuration
@ImportResource("classpath*:/META-INF/spring-xd/bus/codec.xml")
@ImportResource("classpath*:/META-INF/spring-bus/codec.xml")

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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.

public class ChannelBindingAdapterConfiguration {

@Autowired
Expand Down
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;
}

}
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;
}

}
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>
7 changes: 6 additions & 1 deletion spring-xd-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-dirt</artifactId>
<artifactId>spring-xd-codec</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-module</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.xd.dirt.plugins.job.JobPluginMetadataResolver;
import org.springframework.xd.dirt.plugins.stream.ModuleTypeConversionPluginMetadataResolver;
import org.springframework.xd.module.ModuleDefinition;
import org.springframework.xd.module.ModuleDefinitions;
Expand Down Expand Up @@ -104,7 +103,6 @@ private ModuleOptionsMetadataResolver moduleOptionsMetadataResolver(
List<ModuleOptionsMetadataResolver> delegates = new ArrayList<ModuleOptionsMetadataResolver>();
delegates.add(defaultResolver());
delegates.add(new ModuleTypeConversionPluginMetadataResolver());
delegates.add(new JobPluginMetadataResolver());
DelegatingModuleOptionsMetadataResolver delegatingResolver = new DelegatingModuleOptionsMetadataResolver();
delegatingResolver.setDelegates(delegates);
ModuleOptionsMetadataResolver resolver = delegatingResolver;
Expand Down
Loading