@Test public void testSmallMaxMessageSize() { int size = 100; routingConfiguration.setMaxMessageSize(size); routingConfiguration.getAccesscontrol().setEnabled(false); AxonServerClientService dummyPlatformService = new DummyPlatformService(); testSubject = new Gateway(routingConfiguration, Collections.singletonList(dummyPlatformService), accessController, licenseAccessController); testSubject.start(); String aLongName = generateString(size); Channel channel = NettyChannelBuilder.forAddress("localhost", routingConfiguration.getPort()).usePlaintext() .build(); PlatformServiceGrpc.PlatformServiceBlockingStub stub = PlatformServiceGrpc.newBlockingStub(channel); try { stub.getPlatformServer(ClientIdentification.newBuilder().setClientId(aLongName).build()); fail("Should fail on too long"); } catch (StatusRuntimeException sre) { assertTrue(Status.Code.CANCELLED.equals(sre.getStatus().getCode()) || Status.Code.INTERNAL.equals(sre.getStatus().getCode())); } }
@Override public void start() { NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(routingConfiguration.getPort()) .permitKeepAliveWithoutCalls(true) .permitKeepAliveTime(routingConfiguration.getMinKeepAliveTime(), TimeUnit.MILLISECONDS); if( routingConfiguration.getMaxMessageSize() > 0) { serverBuilder.maxInboundMessageSize(routingConfiguration.getMaxMessageSize()); } String sslMessage = "no SSL"; if( routingConfiguration.getSsl() != null && routingConfiguration.getSsl().isEnabled()) { if( routingConfiguration.getSsl().getCertChainFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.cert-chain-file"); } if( routingConfiguration.getSsl().getPrivateKeyFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.private-key-file"); } serverBuilder.useTransportSecurity(new File(routingConfiguration.getSsl().getCertChainFile()), new File(routingConfiguration.getSsl().getPrivateKeyFile())); sslMessage = "SSL enabled"; } axonServerClientServices.forEach(serverBuilder::addService); serverBuilder.intercept(new GrpcBufferingInterceptor(routingConfiguration.getGrpcBufferedMessages())); if( routingConfiguration.getAccesscontrol().isEnabled()) { serverBuilder.intercept(new AuthenticationInterceptor(axonServerAccessController)); } serverBuilder.intercept(new LicenseInterceptor(licenseAccessController)); serverBuilder.intercept(new ContextInterceptor()); if( routingConfiguration.getKeepAliveTime() > 0) { serverBuilder.keepAliveTime(routingConfiguration.getKeepAliveTime(), TimeUnit.MILLISECONDS) .keepAliveTimeout(routingConfiguration.getKeepAliveTimeout(), TimeUnit.MILLISECONDS); } serverBuilder.executor(Executors.newFixedThreadPool(routingConfiguration.getExecutorThreadCount(), new CustomizableThreadFactory("grpc-executor-"))); server = serverBuilder.build(); try { server.start(); logger.info("Axon Server Gateway started on port: {} - {}", routingConfiguration.getPort(), sslMessage); started = true; } catch (IOException e) { logger.error("Starting Axon Server Gateway failed - {}", e.getMessage(), e); } }
Gateway implements SmartLifecycle { @Override public void start() { NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(routingConfiguration.getPort()) .permitKeepAliveWithoutCalls(true) .permitKeepAliveTime(routingConfiguration.getMinKeepAliveTime(), TimeUnit.MILLISECONDS); if( routingConfiguration.getMaxMessageSize() > 0) { serverBuilder.maxInboundMessageSize(routingConfiguration.getMaxMessageSize()); } String sslMessage = "no SSL"; if( routingConfiguration.getSsl() != null && routingConfiguration.getSsl().isEnabled()) { if( routingConfiguration.getSsl().getCertChainFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.cert-chain-file"); } if( routingConfiguration.getSsl().getPrivateKeyFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.private-key-file"); } serverBuilder.useTransportSecurity(new File(routingConfiguration.getSsl().getCertChainFile()), new File(routingConfiguration.getSsl().getPrivateKeyFile())); sslMessage = "SSL enabled"; } axonServerClientServices.forEach(serverBuilder::addService); serverBuilder.intercept(new GrpcBufferingInterceptor(routingConfiguration.getGrpcBufferedMessages())); if( routingConfiguration.getAccesscontrol().isEnabled()) { serverBuilder.intercept(new AuthenticationInterceptor(axonServerAccessController)); } serverBuilder.intercept(new LicenseInterceptor(licenseAccessController)); serverBuilder.intercept(new ContextInterceptor()); if( routingConfiguration.getKeepAliveTime() > 0) { serverBuilder.keepAliveTime(routingConfiguration.getKeepAliveTime(), TimeUnit.MILLISECONDS) .keepAliveTimeout(routingConfiguration.getKeepAliveTimeout(), TimeUnit.MILLISECONDS); } serverBuilder.executor(Executors.newFixedThreadPool(routingConfiguration.getExecutorThreadCount(), new CustomizableThreadFactory("grpc-executor-"))); server = serverBuilder.build(); try { server.start(); logger.info("Axon Server Gateway started on port: {} - {}", routingConfiguration.getPort(), sslMessage); started = true; } catch (IOException e) { logger.error("Starting Axon Server Gateway failed - {}", e.getMessage(), e); } } }
Gateway implements SmartLifecycle { @Override public void start() { NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(routingConfiguration.getPort()) .permitKeepAliveWithoutCalls(true) .permitKeepAliveTime(routingConfiguration.getMinKeepAliveTime(), TimeUnit.MILLISECONDS); if( routingConfiguration.getMaxMessageSize() > 0) { serverBuilder.maxInboundMessageSize(routingConfiguration.getMaxMessageSize()); } String sslMessage = "no SSL"; if( routingConfiguration.getSsl() != null && routingConfiguration.getSsl().isEnabled()) { if( routingConfiguration.getSsl().getCertChainFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.cert-chain-file"); } if( routingConfiguration.getSsl().getPrivateKeyFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.private-key-file"); } serverBuilder.useTransportSecurity(new File(routingConfiguration.getSsl().getCertChainFile()), new File(routingConfiguration.getSsl().getPrivateKeyFile())); sslMessage = "SSL enabled"; } axonServerClientServices.forEach(serverBuilder::addService); serverBuilder.intercept(new GrpcBufferingInterceptor(routingConfiguration.getGrpcBufferedMessages())); if( routingConfiguration.getAccesscontrol().isEnabled()) { serverBuilder.intercept(new AuthenticationInterceptor(axonServerAccessController)); } serverBuilder.intercept(new LicenseInterceptor(licenseAccessController)); serverBuilder.intercept(new ContextInterceptor()); if( routingConfiguration.getKeepAliveTime() > 0) { serverBuilder.keepAliveTime(routingConfiguration.getKeepAliveTime(), TimeUnit.MILLISECONDS) .keepAliveTimeout(routingConfiguration.getKeepAliveTimeout(), TimeUnit.MILLISECONDS); } serverBuilder.executor(Executors.newFixedThreadPool(routingConfiguration.getExecutorThreadCount(), new CustomizableThreadFactory("grpc-executor-"))); server = serverBuilder.build(); try { server.start(); logger.info("Axon Server Gateway started on port: {} - {}", routingConfiguration.getPort(), sslMessage); started = true; } catch (IOException e) { logger.error("Starting Axon Server Gateway failed - {}", e.getMessage(), e); } } Gateway(MessagingPlatformConfiguration messagingPlatformConfiguration, List<AxonServerClientService> axonServerClientServices,
                   AxonServerAccessController axonServerAccessController, LicenseAccessController licenseAccessController); }
Gateway implements SmartLifecycle { @Override public void start() { NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(routingConfiguration.getPort()) .permitKeepAliveWithoutCalls(true) .permitKeepAliveTime(routingConfiguration.getMinKeepAliveTime(), TimeUnit.MILLISECONDS); if( routingConfiguration.getMaxMessageSize() > 0) { serverBuilder.maxInboundMessageSize(routingConfiguration.getMaxMessageSize()); } String sslMessage = "no SSL"; if( routingConfiguration.getSsl() != null && routingConfiguration.getSsl().isEnabled()) { if( routingConfiguration.getSsl().getCertChainFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.cert-chain-file"); } if( routingConfiguration.getSsl().getPrivateKeyFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.private-key-file"); } serverBuilder.useTransportSecurity(new File(routingConfiguration.getSsl().getCertChainFile()), new File(routingConfiguration.getSsl().getPrivateKeyFile())); sslMessage = "SSL enabled"; } axonServerClientServices.forEach(serverBuilder::addService); serverBuilder.intercept(new GrpcBufferingInterceptor(routingConfiguration.getGrpcBufferedMessages())); if( routingConfiguration.getAccesscontrol().isEnabled()) { serverBuilder.intercept(new AuthenticationInterceptor(axonServerAccessController)); } serverBuilder.intercept(new LicenseInterceptor(licenseAccessController)); serverBuilder.intercept(new ContextInterceptor()); if( routingConfiguration.getKeepAliveTime() > 0) { serverBuilder.keepAliveTime(routingConfiguration.getKeepAliveTime(), TimeUnit.MILLISECONDS) .keepAliveTimeout(routingConfiguration.getKeepAliveTimeout(), TimeUnit.MILLISECONDS); } serverBuilder.executor(Executors.newFixedThreadPool(routingConfiguration.getExecutorThreadCount(), new CustomizableThreadFactory("grpc-executor-"))); server = serverBuilder.build(); try { server.start(); logger.info("Axon Server Gateway started on port: {} - {}", routingConfiguration.getPort(), sslMessage); started = true; } catch (IOException e) { logger.error("Starting Axon Server Gateway failed - {}", e.getMessage(), e); } } Gateway(MessagingPlatformConfiguration messagingPlatformConfiguration, List<AxonServerClientService> axonServerClientServices,
                   AxonServerAccessController axonServerAccessController, LicenseAccessController licenseAccessController); @Override boolean isAutoStartup(); @Override void stop(Runnable callback); @Override void start(); @Override void stop(); @Override boolean isRunning(); @Override int getPhase(); }
Gateway implements SmartLifecycle { @Override public void start() { NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(routingConfiguration.getPort()) .permitKeepAliveWithoutCalls(true) .permitKeepAliveTime(routingConfiguration.getMinKeepAliveTime(), TimeUnit.MILLISECONDS); if( routingConfiguration.getMaxMessageSize() > 0) { serverBuilder.maxInboundMessageSize(routingConfiguration.getMaxMessageSize()); } String sslMessage = "no SSL"; if( routingConfiguration.getSsl() != null && routingConfiguration.getSsl().isEnabled()) { if( routingConfiguration.getSsl().getCertChainFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.cert-chain-file"); } if( routingConfiguration.getSsl().getPrivateKeyFile() == null) { throw new RuntimeException("axoniq.axonserver.ssl.private-key-file"); } serverBuilder.useTransportSecurity(new File(routingConfiguration.getSsl().getCertChainFile()), new File(routingConfiguration.getSsl().getPrivateKeyFile())); sslMessage = "SSL enabled"; } axonServerClientServices.forEach(serverBuilder::addService); serverBuilder.intercept(new GrpcBufferingInterceptor(routingConfiguration.getGrpcBufferedMessages())); if( routingConfiguration.getAccesscontrol().isEnabled()) { serverBuilder.intercept(new AuthenticationInterceptor(axonServerAccessController)); } serverBuilder.intercept(new LicenseInterceptor(licenseAccessController)); serverBuilder.intercept(new ContextInterceptor()); if( routingConfiguration.getKeepAliveTime() > 0) { serverBuilder.keepAliveTime(routingConfiguration.getKeepAliveTime(), TimeUnit.MILLISECONDS) .keepAliveTimeout(routingConfiguration.getKeepAliveTimeout(), TimeUnit.MILLISECONDS); } serverBuilder.executor(Executors.newFixedThreadPool(routingConfiguration.getExecutorThreadCount(), new CustomizableThreadFactory("grpc-executor-"))); server = serverBuilder.build(); try { server.start(); logger.info("Axon Server Gateway started on port: {} - {}", routingConfiguration.getPort(), sslMessage); started = true; } catch (IOException e) { logger.error("Starting Axon Server Gateway failed - {}", e.getMessage(), e); } } Gateway(MessagingPlatformConfiguration messagingPlatformConfiguration, List<AxonServerClientService> axonServerClientServices,
                   AxonServerAccessController axonServerAccessController, LicenseAccessController licenseAccessController); @Override boolean isAutoStartup(); @Override void stop(Runnable callback); @Override void start(); @Override void stop(); @Override boolean isRunning(); @Override int getPhase();  }