How to expose Hystrix Stream on Spring Actuator port? -
i using jetty embedded server in spring boot application.
to handle requests provide custom handler that.
@slf4j @configuration @enablewebmvc @springbootapplication public class main {     public static void main(string... args) {         new springapplicationbuilder().sources(main.class).run(args);     }      @bean     public embeddedservletcontainercustomizer customizer(jettyrequesthandler mycustomhandler) throws malformedurlexception {         return new embeddedservletcontainercustomizer() {              @override             public void customize(configurableembeddedservletcontainer container) {                 if (container instanceof jettyembeddedservletcontainerfactory) {                     customizejetty((jettyembeddedservletcontainerfactory) container);                 }             }              private void customizejetty(jettyembeddedservletcontainerfactory jetty) {                 jetty.addservercustomizers((jettyservercustomizer) server -> {                     handlercollection handlercollection = new handlercollection();                     handlercollection.sethandlers(new handler[]{mycustomhandler, server.gethandler()});                     server.sethandler(handlercollection);                 });             }         };     } } i listening requests on standard 8080 port. included spring boot actuator project production endpoints (health, etc.).  starts on port: 8181.
additionally using hystrix circuit breaking purposes.
my question how enable hystrix stream exposed on actuator port?
currently managed expose on standard port 8080 following piece of code:
@bean public servletregistrationbean hystrixstreamservlet(){     return new servletregistrationbean(new hystrixmetricsstreamservlet(), "/hystrix.stream"); } but expose on another, have default 1 application purposes.
those of dependecies:
compile 'com.netflix.hystrix:hystrix-core:1.5.3' compile 'com.netflix.hystrix:hystrix-metrics-event-stream:1.5.3'  compile 'org.springframework.boot:spring-boot-starter-actuator:1.3.5.release'  i not use spring cloud @enablehystrix gives stream on actuator port actually.
actually did @m-deinum proposed , worked. used spring cloud stack.
to achieve hystrix stream on actuator added dependecies:
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter', version: '1.1.1.release'          // spring cloud starter compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-hystrix', version: '1.1.3.release'  // spring cloud hystrix starter compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-ribbon', version: '1.1.3.release'   // spring ribbon starter and annotation on main class:
@enablecircuitbreaker @springbootapplication public class main {     public static void main(string... args) {         new springapplicationbuilder().sources(main.class).run(args);     }     // ... } 
Comments
Post a Comment