Interface MicroBootstrapFlow<Bootstrap>

All Superinterfaces:
ExternalSettingAware
All Known Implementing Classes:
TcpMicroBootstrapFlow, WebSocketMicroBootstrapFlow

public interface MicroBootstrapFlow<Bootstrap> extends ExternalSettingAware
The startup process for a server that connects with real players.
Developers can use this interface to orchestrate the server, with orchestration divided into two phases: build time and new connection time.

You can also selectively override the process methods to customize the business logic for your own projects.
The framework provides implementations for TCP, WebSocket, and UDP.

The execution order of the interface methods is:

1. The execution flow for [Build Time], where createFlow calls the option and channelInitializer methods.
1.1 option
1.2 channelInitializer

2. The execution flow for [New Connection Time], where pipelineFlow calls pipelineCodec, pipelineIdle, and pipelineCustom.
2.1 pipelineCodec
2.2 pipelineIdle
2.3 pipelineCustom
Author:
渔民小镇
date:
2023-05-28
  • Method Details

    • option

      void option(Bootstrap bootstrap)
      Configures some options for the server. The server is not yet started at this point.
      Parameters:
      bootstrap - The server bootstrap.
    • channelInitializer

      void channelInitializer(Bootstrap bootstrap)
      Arranges some business orchestration for the server. The server is not yet started at this point.
      Parameters:
      bootstrap - The server bootstrap.
    • pipelineFlow

      default void pipelineFlow(PipelineContext pipelineContext)
      The execution flow when a new connection is established.
      Typically, we can divide the implementation within ChannelInitializer into three parts:
      1. pipelineCodec: Encoding and decoding.
      2. pipelineIdle: Heartbeat-related logic.
      3. pipelineCustom: Custom business orchestration (in most cases, just overriding pipelineCustom is enough for strong extension).
      
      Parameters:
      pipelineContext - context
    • pipelineCodec

      void pipelineCodec(PipelineContext context)
      Orchestrates the encoding and decoding logic.
      Parameters:
      context - The PipelineContext.
    • pipelineIdle

      void pipelineIdle(PipelineContext context)
      Orchestrates the heartbeat-related logic.
      Parameters:
      context - The PipelineContext.
    • pipelineCustom

      void pipelineCustom(PipelineContext context)
      Custom business orchestration (to arrange some business logic for the server).
      Parameters:
      context - The PipelineContext.