Skip to content

Commit

Permalink
Update to new stream ChannelBindingServiceProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
spencergibb committed Sep 25, 2015
1 parent befcada commit 0a2d170
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@


package org.springframework.cloud.netflix.hystrix.stream; package org.springframework.cloud.netflix.hystrix.stream;


import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;


import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.config.ChannelBindingProperties; import org.springframework.cloud.stream.config.BindingProperties;
import org.springframework.cloud.stream.config.ChannelBindingServiceProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
Expand Down Expand Up @@ -58,22 +56,21 @@
public class HystrixStreamAutoConfiguration { public class HystrixStreamAutoConfiguration {


@Autowired @Autowired
private ChannelBindingProperties bindings; private ChannelBindingServiceProperties bindings;


@Autowired @Autowired
private HystrixStreamProperties properties; private HystrixStreamProperties properties;


@PostConstruct @PostConstruct
public void init() { public void init() {
Object outputBinding = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT); BindingProperties outputBinding = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT);
if (outputBinding == null || outputBinding instanceof String) { if (outputBinding == null) {
this.bindings.getBindings().put(HystrixStreamClient.OUTPUT, this.bindings.getBindings().put(HystrixStreamClient.OUTPUT,
new HashMap<String, Object>()); new BindingProperties());
} }
@SuppressWarnings("unchecked") BindingProperties output = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT);
Map<String, Object> output = (Map<String, Object>) this.bindings.getBindings().get(HystrixStreamClient.OUTPUT); if (output.getDestination() == null) {
if (!output.containsKey("destination") || HystrixStreamClient.OUTPUT.equals(outputBinding)) { output.setDestination(this.properties.getDestination());
output.put("destination", this.properties.getDestination());
} }
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@


package org.springframework.cloud.netflix.turbine.stream; package org.springframework.cloud.netflix.turbine.stream;


import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;


import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.config.ChannelBindingProperties; import org.springframework.cloud.stream.config.BindingProperties;
import org.springframework.cloud.stream.config.ChannelBindingServiceProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;


Expand Down Expand Up @@ -54,22 +52,21 @@
public class TurbineStreamAutoConfiguration { public class TurbineStreamAutoConfiguration {


@Autowired @Autowired
private ChannelBindingProperties bindings; private ChannelBindingServiceProperties bindings;


@Autowired @Autowired
private TurbineStreamProperties properties; private TurbineStreamProperties properties;


@PostConstruct @PostConstruct
public void init() { public void init() {
Object inputBinding = this.bindings.getBindings().get(TurbineStreamClient.INPUT); BindingProperties inputBinding = this.bindings.getBindings().get(TurbineStreamClient.INPUT);
if (inputBinding == null || inputBinding instanceof String) { if (inputBinding == null) {
this.bindings.getBindings().put(TurbineStreamClient.INPUT, this.bindings.getBindings().put(TurbineStreamClient.INPUT,
new HashMap<String, Object>()); new BindingProperties());
} }
@SuppressWarnings("unchecked") BindingProperties input = this.bindings.getBindings().get(TurbineStreamClient.INPUT);
Map<String, Object> input = (Map<String, Object>) this.bindings.getBindings().get(TurbineStreamClient.INPUT); if (input.getDestination() == null) {
if (!input.containsKey("destination") || TurbineStreamClient.INPUT.equals(inputBinding)) { input.setDestination(properties.getDestination());
input.put("destination", properties.getDestination());
} }
} }


Expand Down

0 comments on commit 0a2d170

Please sign in to comment.