Search in sources :

Example 1 with EventMeshTcpMonitor

use of org.apache.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor in project incubator-eventmesh by apache.

the class EventMeshTCPServer method init.

public void init() throws Exception {
    logger.info("==================EventMeshTCPServer Initialing==================");
    initThreadPool();
    rateLimiter = RateLimiter.create(eventMeshTCPConfiguration.eventMeshTcpMsgReqnumPerSecond);
    globalTrafficShapingHandler = newGTSHandler();
    clientManageController = new ClientManageController(this);
    clientSessionGroupMapping = new ClientSessionGroupMapping(this);
    clientSessionGroupMapping.init();
    eventMeshTcpRetryer = new EventMeshTcpRetryer(this);
    eventMeshTcpRetryer.init();
    // The MetricsRegistry is singleton, so we can use factory method to get.
    final List<MetricsRegistry> metricsRegistries = Lists.newArrayList();
    Optional.ofNullable(eventMeshTCPConfiguration.eventMeshMetricsPluginType).ifPresent(metricsPlugins -> metricsPlugins.forEach(pluginType -> metricsRegistries.add(MetricsPluginFactory.getMetricsRegistry(pluginType))));
    eventMeshTcpMonitor = new EventMeshTcpMonitor(this, metricsRegistries);
    eventMeshTcpMonitor.init();
    if (eventMeshTCPConfiguration.eventMeshServerRegistryEnable) {
        eventMeshRebalanceService = new EventMeshRebalanceService(this, new EventmeshRebalanceImpl(this));
        eventMeshRebalanceService.init();
    }
    logger.info("--------------------------EventMeshTCPServer Inited");
}
Also used : EventMeshTcpConnectionHandler(org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcpConnectionHandler) EventmeshRebalanceImpl(org.apache.eventmesh.runtime.core.protocol.tcp.client.rebalance.EventmeshRebalanceImpl) EventMeshConstants(org.apache.eventmesh.runtime.constants.EventMeshConstants) ScheduledFuture(java.util.concurrent.ScheduledFuture) ChannelOption(io.netty.channel.ChannelOption) IPUtils(org.apache.eventmesh.common.utils.IPUtils) MetricsPluginFactory(org.apache.eventmesh.metrics.api.MetricsPluginFactory) EventMeshTcpExceptionHandler(org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcpExceptionHandler) GlobalTrafficShapingHandler(io.netty.handler.traffic.GlobalTrafficShapingHandler) RateLimiter(com.google.common.util.concurrent.RateLimiter) EventMeshThreadFactoryImpl(org.apache.eventmesh.runtime.util.EventMeshThreadFactoryImpl) EventMeshException(org.apache.eventmesh.common.exception.EventMeshException) EventMeshTcpRetryer(org.apache.eventmesh.runtime.core.protocol.tcp.client.session.retry.EventMeshTcpRetryer) Registry(org.apache.eventmesh.runtime.registry.Registry) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) EventMeshTcpMonitor(org.apache.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor) AdaptiveRecvByteBufAllocator(io.netty.channel.AdaptiveRecvByteBufAllocator) ExecutorService(java.util.concurrent.ExecutorService) ClientSessionGroupMapping(org.apache.eventmesh.runtime.core.protocol.tcp.client.group.ClientSessionGroupMapping) ClientManageController(org.apache.eventmesh.runtime.admin.controller.ClientManageController) ChannelInitializer(io.netty.channel.ChannelInitializer) ChannelTrafficShapingHandler(io.netty.handler.traffic.ChannelTrafficShapingHandler) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) EventMeshTcpMessageDispatcher(org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcpMessageDispatcher) EventMeshRegisterInfo(org.apache.eventmesh.api.registry.dto.EventMeshRegisterInfo) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) EventMeshTCPConfiguration(org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) ThreadPoolFactory(org.apache.eventmesh.common.ThreadPoolFactory) ChannelFuture(io.netty.channel.ChannelFuture) TimeUnit(java.util.concurrent.TimeUnit) Channel(io.netty.channel.Channel) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) List(java.util.List) EventMeshUnRegisterInfo(org.apache.eventmesh.api.registry.dto.EventMeshUnRegisterInfo) EventMeshRebalanceService(org.apache.eventmesh.runtime.core.protocol.tcp.client.rebalance.EventMeshRebalanceService) Lists(org.assertj.core.util.Lists) MetricsRegistry(org.apache.eventmesh.metrics.api.MetricsRegistry) Codec(org.apache.eventmesh.common.protocol.tcp.codec.Codec) Optional(java.util.Optional) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) EventMeshTcpRetryer(org.apache.eventmesh.runtime.core.protocol.tcp.client.session.retry.EventMeshTcpRetryer) MetricsRegistry(org.apache.eventmesh.metrics.api.MetricsRegistry) EventMeshTcpMonitor(org.apache.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor) ClientSessionGroupMapping(org.apache.eventmesh.runtime.core.protocol.tcp.client.group.ClientSessionGroupMapping) EventmeshRebalanceImpl(org.apache.eventmesh.runtime.core.protocol.tcp.client.rebalance.EventmeshRebalanceImpl) ClientManageController(org.apache.eventmesh.runtime.admin.controller.ClientManageController) EventMeshRebalanceService(org.apache.eventmesh.runtime.core.protocol.tcp.client.rebalance.EventMeshRebalanceService)

Aggregations

RateLimiter (com.google.common.util.concurrent.RateLimiter)1 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 AdaptiveRecvByteBufAllocator (io.netty.channel.AdaptiveRecvByteBufAllocator)1 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 ChannelOption (io.netty.channel.ChannelOption)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 ChannelTrafficShapingHandler (io.netty.handler.traffic.ChannelTrafficShapingHandler)1 GlobalTrafficShapingHandler (io.netty.handler.traffic.GlobalTrafficShapingHandler)1 List (java.util.List)1 Optional (java.util.Optional)1 ExecutorService (java.util.concurrent.ExecutorService)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ScheduledFuture (java.util.concurrent.ScheduledFuture)1 TimeUnit (java.util.concurrent.TimeUnit)1 EventMeshRegisterInfo (org.apache.eventmesh.api.registry.dto.EventMeshRegisterInfo)1