Class MoleculerServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
services.moleculer.web.servlet.MoleculerServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class MoleculerServlet extends jakarta.servlet.http.HttpServlet
Servlet for embedding Moleculer Service Broker as J2EE Servlet.
  • moleculer.application = Class name of the main Spring Boot Application
  • moleculer.config = For XML-based Spring Context, the path of the config
  • moleculer.force.blocking = Force blocking mode (default = auto)
  • moleculer.blocking.timeout = Timeout in blocking mode (default = 0)
  • moleculer.async.timeout = Async request timeout in msec, non-blocking mode (0 = use container default; default = 0)
  • moleculer.inprocess = Inprocess execution blocking mode (default = true)
  • moleculer.check.period = WebSocket check period (sec, default = 15)
See Also:
  • Field Details

    • context

      protected final AtomicReference<org.springframework.context.ConfigurableApplicationContext> context
    • broker

      protected services.moleculer.ServiceBroker broker
    • gateway

      protected ApiGateway gateway
    • webSocketRegistry

      protected ServletWebSocketRegistry webSocketRegistry
    • serviceMode

      protected ServiceMode serviceMode
    • timeout

      protected long timeout
    • asyncTimeout

      protected long asyncTimeout
  • Constructor Details

    • MoleculerServlet

      public MoleculerServlet()
  • Method Details

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
    • service

      public void service(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse rsp) throws jakarta.servlet.ServletException, IOException
      Specified by:
      service in interface jakarta.servlet.Servlet
      Overrides:
      service in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • handleError

      protected void handleError(jakarta.servlet.http.HttpServletResponse response, Throwable cause)
    • logInfo

      protected void logInfo(String message)
    • logError

      protected void logError(String message, Throwable cause)
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet
    • getGateway

      public ApiGateway getGateway()
    • getBroker

      public services.moleculer.ServiceBroker getBroker()
    • getServiceMode

      public final ServiceMode getServiceMode()
    • setServiceMode

      public final void setServiceMode(ServiceMode serviceMode)