Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
0d92cb08
Commit
0d92cb08
authored
Sep 22, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow defaults for spring-cloud-stream bindings
parent
639a87bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
18 deletions
+43
-18
HystrixStreamAutoConfiguration.java
...etflix/hystrix/stream/HystrixStreamAutoConfiguration.java
+18
-7
HystrixStreamClient.java
...ork/cloud/netflix/hystrix/stream/HystrixStreamClient.java
+1
-2
HystrixStreamProperties.java
...cloud/netflix/hystrix/stream/HystrixStreamProperties.java
+3
-0
TurbineStreamAutoConfiguration.java
...etflix/turbine/stream/TurbineStreamAutoConfiguration.java
+18
-7
TurbineStreamClient.java
...ork/cloud/netflix/turbine/stream/TurbineStreamClient.java
+1
-2
TurbineStreamProperties.java
...cloud/netflix/turbine/stream/TurbineStreamProperties.java
+2
-0
No files found.
spring-cloud-netflix-hystrix-stream/src/main/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamAutoConfiguration.java
View file @
0d92cb08
...
...
@@ -16,6 +16,11 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
.
stream
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.annotation.PostConstruct
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
...
...
@@ -28,10 +33,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import
com.netflix.hystrix.HystrixCircuitBreaker
;
import
javax.annotation.PostConstruct
;
import
java.util.Collections
;
import
java.util.HashMap
;
/**
* Autoconfiguration for a Spring Cloud Hystrix on AMQP. Enabled by default if
* spring-rabbit is on the classpath, and can be switched off with
...
...
@@ -59,11 +60,21 @@ public class HystrixStreamAutoConfiguration {
@Autowired
private
ChannelBindingProperties
bindings
;
@Autowired
private
HystrixStreamProperties
properties
;
@PostConstruct
public
void
init
()
{
this
.
bindings
.
getBindings
().
put
(
HystrixStreamClient
.
OUTPUT
,
new
HashMap
<>(
Collections
.
singletonMap
(
"destination"
,
HystrixStreamClient
.
HYSTRIX_STREAM_DESTINATION
)));
Object
outputBinding
=
this
.
bindings
.
getBindings
().
get
(
HystrixStreamClient
.
OUTPUT
);
if
(
outputBinding
==
null
||
outputBinding
instanceof
String
)
{
this
.
bindings
.
getBindings
().
put
(
HystrixStreamClient
.
OUTPUT
,
new
HashMap
<
String
,
Object
>());
}
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
output
=
(
Map
<
String
,
Object
>)
this
.
bindings
.
getBindings
().
get
(
HystrixStreamClient
.
OUTPUT
);
if
(!
output
.
containsKey
(
"destination"
)
||
HystrixStreamClient
.
OUTPUT
.
equals
(
outputBinding
))
{
output
.
put
(
"destination"
,
this
.
properties
.
getDestination
());
}
}
@Bean
...
...
spring-cloud-netflix-hystrix-stream/src/main/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamClient.java
View file @
0d92cb08
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
.
stream
;
import
org.springframework.cloud.netflix.hystrix.HystrixConstants
;
import
org.springframework.cloud.stream.annotation.Output
;
import
org.springframework.messaging.MessageChannel
;
...
...
@@ -24,7 +23,7 @@ import org.springframework.messaging.MessageChannel;
* @author Dave Syer
*
*/
public
interface
HystrixStreamClient
extends
HystrixConstants
{
public
interface
HystrixStreamClient
{
String
OUTPUT
=
"hystrixStreamOutput"
;
...
...
spring-cloud-netflix-hystrix-stream/src/main/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamProperties.java
View file @
0d92cb08
...
...
@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.hystrix.stream;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.cloud.netflix.hystrix.HystrixConstants
;
/**
* @author Spencer Gibb
...
...
@@ -33,4 +34,6 @@ public class HystrixStreamProperties {
private
boolean
sendId
=
true
;
private
String
destination
=
HystrixConstants
.
HYSTRIX_STREAM_DESTINATION
;
}
spring-cloud-netflix-turbine-stream/src/main/java/org/springframework/cloud/netflix/turbine/stream/TurbineStreamAutoConfiguration.java
View file @
0d92cb08
...
...
@@ -16,6 +16,11 @@
package
org
.
springframework
.
cloud
.
netflix
.
turbine
.
stream
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.annotation.PostConstruct
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
...
...
@@ -24,10 +29,6 @@ import org.springframework.cloud.stream.config.ChannelBindingProperties;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
import
java.util.Collections
;
import
java.util.HashMap
;
/**
* Autoconfiguration for a Spring Cloud Turbine using Spring Cloud Stream.
* Enabled by default if spring-cloud-stream is on the classpath, and can be
...
...
@@ -55,11 +56,21 @@ public class TurbineStreamAutoConfiguration {
@Autowired
private
ChannelBindingProperties
bindings
;
@Autowired
private
TurbineStreamProperties
properties
;
@PostConstruct
public
void
init
()
{
this
.
bindings
.
getBindings
().
put
(
TurbineStreamClient
.
INPUT
,
new
HashMap
<>(
Collections
.
singletonMap
(
"destination"
,
TurbineStreamClient
.
HYSTRIX_STREAM_DESTINATION
)));
Object
inputBinding
=
this
.
bindings
.
getBindings
().
get
(
TurbineStreamClient
.
INPUT
);
if
(
inputBinding
==
null
||
inputBinding
instanceof
String
)
{
this
.
bindings
.
getBindings
().
put
(
TurbineStreamClient
.
INPUT
,
new
HashMap
<
String
,
Object
>());
}
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
input
=
(
Map
<
String
,
Object
>)
this
.
bindings
.
getBindings
().
get
(
TurbineStreamClient
.
INPUT
);
if
(!
input
.
containsKey
(
"destination"
)
||
TurbineStreamClient
.
INPUT
.
equals
(
inputBinding
))
{
input
.
put
(
"destination"
,
properties
.
getDestination
());
}
}
@Bean
...
...
spring-cloud-netflix-turbine-stream/src/main/java/org/springframework/cloud/netflix/turbine/stream/TurbineStreamClient.java
View file @
0d92cb08
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
cloud
.
netflix
.
turbine
.
stream
;
import
org.springframework.cloud.netflix.hystrix.HystrixConstants
;
import
org.springframework.cloud.stream.annotation.Input
;
import
org.springframework.messaging.SubscribableChannel
;
...
...
@@ -24,7 +23,7 @@ import org.springframework.messaging.SubscribableChannel;
* @author Dave Syer
*
*/
public
interface
TurbineStreamClient
extends
HystrixConstants
{
public
interface
TurbineStreamClient
{
String
INPUT
=
"turbineStreamInput"
;
...
...
spring-cloud-netflix-turbine-stream/src/main/java/org/springframework/cloud/netflix/turbine/stream/TurbineStreamProperties.java
View file @
0d92cb08
...
...
@@ -20,6 +20,7 @@ import lombok.Data;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.cloud.netflix.hystrix.HystrixConstants
;
/**
* @author Dave Syer
...
...
@@ -31,4 +32,5 @@ public class TurbineStreamProperties {
@Value
(
"${server.port:8989}"
)
private
int
port
=
8989
;
private
String
destination
=
HystrixConstants
.
HYSTRIX_STREAM_DESTINATION
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment