Search in sources :

Example 1 with EventMeshTCPConfiguration

use of org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration in project incubator-eventmesh by apache.

the class EventMeshStartup method main.

public static void main(String[] args) throws Exception {
    try {
        ConfigurationWrapper configurationWrapper = new ConfigurationWrapper(EventMeshConstants.EVENTMESH_CONF_HOME + File.separator + EventMeshConstants.EVENTMESH_CONF_FILE, false);
        EventMeshHTTPConfiguration eventMeshHttpConfiguration = new EventMeshHTTPConfiguration(configurationWrapper);
        eventMeshHttpConfiguration.init();
        EventMeshTCPConfiguration eventMeshTCPConfiguration = new EventMeshTCPConfiguration(configurationWrapper);
        eventMeshTCPConfiguration.init();
        EventMeshGrpcConfiguration eventMeshGrpcConfiguration = new EventMeshGrpcConfiguration(configurationWrapper);
        eventMeshGrpcConfiguration.init();
        EventMeshServer server = new EventMeshServer(eventMeshHttpConfiguration, eventMeshTCPConfiguration, eventMeshGrpcConfiguration);
        server.init();
        server.start();
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            try {
                logger.info("eventMesh shutting down hook begin...");
                long start = System.currentTimeMillis();
                server.shutdown();
                long end = System.currentTimeMillis();
                logger.info("eventMesh shutdown cost {}ms", end - start);
            } catch (Exception e) {
                logger.error("exception when shutdown...", e);
            }
        }));
    } catch (Throwable e) {
        logger.error("EventMesh start fail.", e);
        e.printStackTrace();
    }
}
Also used : EventMeshTCPConfiguration(org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration) ConfigurationWrapper(org.apache.eventmesh.common.config.ConfigurationWrapper) EventMeshGrpcConfiguration(org.apache.eventmesh.runtime.configuration.EventMeshGrpcConfiguration) EventMeshHTTPConfiguration(org.apache.eventmesh.runtime.configuration.EventMeshHTTPConfiguration)

Aggregations

ConfigurationWrapper (org.apache.eventmesh.common.config.ConfigurationWrapper)1 EventMeshGrpcConfiguration (org.apache.eventmesh.runtime.configuration.EventMeshGrpcConfiguration)1 EventMeshHTTPConfiguration (org.apache.eventmesh.runtime.configuration.EventMeshHTTPConfiguration)1 EventMeshTCPConfiguration (org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration)1