1

Similar with this post, I created another turbine stream based application to collect hystrix stream from other applications.

Spring Boot: 2.0.4.RELEASE, Spring Cloud: Finchley.SR1

The application class:

@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbineStream
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

The maven dependencies:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-turbine-stream</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

The application config file is:

server:
  port: 8989
spring:
  application:
    name: hystrix-turbine-stream

management:
  endpoints:
    web.exposure.include: '*'

When I explore the source codes of @EanbleTurbineStream, and found TurbineController expose a Flux to the root '/' endpiont.

But when I tried to explore http://localhost:8989 in the Hystrix Dashboard, found it did not work as expected.

Update: When I tried to access the turbine stream application, and got:

curl http://localhost:8989
data:{"type":"ping"}

data:{"type":"ping"}

data:{"type":"ping"}

data:{"type":"ping"}

In the application console(logging), there is some log shown as:

: Registering MessageChannel turbineStreamInput

But I can not see the there are some message sent to this channel in my client app.

Here is the sample codes of my turbine stream application

Update2: Got it worked, I used a outdated spring-cloud-starter-netflix-hystrix-stream (which is existed in v2.0.0M2, but not existed in the final RELEASE version) in my client app, when I used spring-cloud-starter-netflix-hystrix and spring-cloud-netflix-hystrix-stream combination in the client app, it worked well.

Hantsy
  • 8,006
  • 7
  • 64
  • 109

2 Answers2

1

@Hantsy We would need more details regarding what your failures are here. I have a running Spring Boot: 2.0.4.RELEASE, Spring Cloud: Finchley.SR1 turbine stream app so I can help if you need further clarification.

For @EnableTurbineStream to work properly, you'll need to add the below dependencies in your app according to documentation here https://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#_turbine_stream

spring-cloud-starter-netflix-turbine-stream
spring-boot-starter-webflux
spring-cloud-stream-binder-rabbit 

(any spring-cloud-stream-* would do, raabitmq worked for me)

On the client, add a dependency to spring-cloud-netflix-hystrix-stream and the spring-cloud-starter-stream-* of your choice.

Add the rabbitmq (in my case) configuration on your application.properties/application.yml file of your client and the turbine-stream app:

spring:
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest

Hope this helps.

storesource
  • 141
  • 1
  • 7
  • Could you please guide me here: https://stackoverflow.com/questions/59738969/unable-to-connect-to-command-metric-stream-in-hystrix-dashboard-issue ? – PAA Jan 18 '20 at 05:18
1

You should set properties on client app project: spring.cloud.stream.bindings.hystrixStreamOutput.destination=springCloudHystrixStream

PAA
  • 1
  • 46
  • 174
  • 282
tuantm
  • 9
  • 3