Class ProxyMgmtComponent

  • All Implemented Interfaces:
    ManagementComponent

    public class ProxyMgmtComponent
    extends MgmtComponentImpl
    Management Component that allows you to proxy various HTTP requests internally.

    The use case for this is something like Heroku which generally only allows you to expose a single external port. If you have an existing API endpoint listening via embedded jetty and you have also require jolokia then you need to jump through additional hoops to make this possible (it could be done by having an additional API endpoint workflow that proxies everything to the jolokia endpoint). This is a very simplified proxy simply passes through all headers as-is to the proxied URL.

    If we take the following configuration (note the use of :: as the separator) :-

     
     interlok.proxy.1=/jolokia::http://localhost:8081
     interlok.proxy.2=/alternate::http://my.other.host:8082
     
     
    In this case we would register as a listener against the URI /jolokia/* and /alternate/* against the embedded jetty component. All traffic to our registered URI (e.g. http://localhost:8080/jolokia/my/jolokia/action) would be forwarded to the corresponding server/port combination (http://localhost:8081/jolokia/my/jolokia/action).

    • Constructor Detail

      • ProxyMgmtComponent

        public ProxyMgmtComponent()
    • Method Detail

      • init

        public void init​(java.util.Properties config)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • start

        public void start()
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • stop

        public void stop()
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • destroy

        public void destroy()
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • build

        protected java.util.List<StandaloneConsumer> build​(java.util.Properties config)