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();
}
}
Aggregations