Search in sources :

Example 1 with ContainerEventBusModule

use of com.netflix.titus.common.util.guice.ContainerEventBusModule in project titus-control-plane by Netflix.

the class TitusFederationModule method configure.

@Override
protected void configure() {
    bind(Archaius2ConfigurationLogger.class).asEagerSingleton();
    bind(Registry.class).toInstance(new DefaultRegistry());
    bind(SystemLogService.class).to(LoggingSystemLogService.class);
    bind(SystemAbortListener.class).to(LoggingSystemAbortListener.class);
    install(new GovernatorJerseySupportModule());
    install(new ContainerEventBusModule());
    install(new TitusEntitySanitizerModule());
    bind(HostCallerIdResolver.class).to(NoOpHostCallerIdResolver.class);
    bind(CellConnector.class).to(DefaultCellConnector.class);
    bind(RemoteFederationConnector.class).to(DefaultRemoteFederationConnector.class);
    bind(CellWebClientConnector.class).to(DefaultCellWebClientConnector.class);
    bind(WebClientFactory.class).toInstance(SimpleWebClientFactory.getInstance());
    bind(CellInfoResolver.class).to(DefaultCellInfoResolver.class);
    bind(RemoteFederationInfoResolver.class).to(DefaultRemoteFederationInfoResolver.class);
    install(new FederationEndpointModule());
    install(new ServiceModule());
}
Also used : Archaius2ConfigurationLogger(com.netflix.titus.common.util.archaius2.Archaius2ConfigurationLogger) LoggingSystemAbortListener(com.netflix.titus.common.runtime.internal.LoggingSystemAbortListener) SystemAbortListener(com.netflix.titus.common.runtime.SystemAbortListener) CellInfoResolver(com.netflix.titus.federation.service.CellInfoResolver) DefaultCellInfoResolver(com.netflix.titus.federation.service.DefaultCellInfoResolver) LoggingSystemLogService(com.netflix.titus.common.runtime.internal.LoggingSystemLogService) SystemLogService(com.netflix.titus.common.runtime.SystemLogService) RemoteFederationConnector(com.netflix.titus.federation.service.RemoteFederationConnector) DefaultRemoteFederationConnector(com.netflix.titus.federation.service.DefaultRemoteFederationConnector) GovernatorJerseySupportModule(com.netflix.governator.guice.jersey.GovernatorJerseySupportModule) DefaultCellWebClientConnector(com.netflix.titus.federation.service.DefaultCellWebClientConnector) CellWebClientConnector(com.netflix.titus.federation.service.CellWebClientConnector) SimpleWebClientFactory(com.netflix.titus.federation.service.SimpleWebClientFactory) WebClientFactory(com.netflix.titus.federation.service.WebClientFactory) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) Registry(com.netflix.spectator.api.Registry) CellConnector(com.netflix.titus.federation.service.CellConnector) DefaultCellConnector(com.netflix.titus.federation.service.DefaultCellConnector) ServiceModule(com.netflix.titus.federation.service.ServiceModule) ContainerEventBusModule(com.netflix.titus.common.util.guice.ContainerEventBusModule) FederationEndpointModule(com.netflix.titus.federation.endpoint.FederationEndpointModule) RemoteFederationInfoResolver(com.netflix.titus.federation.service.RemoteFederationInfoResolver) DefaultRemoteFederationInfoResolver(com.netflix.titus.federation.service.DefaultRemoteFederationInfoResolver) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) TitusEntitySanitizerModule(com.netflix.titus.runtime.TitusEntitySanitizerModule) NoOpHostCallerIdResolver(com.netflix.titus.runtime.endpoint.resolver.NoOpHostCallerIdResolver) HostCallerIdResolver(com.netflix.titus.runtime.endpoint.resolver.HostCallerIdResolver)

Example 2 with ContainerEventBusModule

use of com.netflix.titus.common.util.guice.ContainerEventBusModule in project titus-control-plane by Netflix.

the class ActivationProvisionListenerTest method testDeactivationOrderIsReverseOfActivation.

@Test
public void testDeactivationOrderIsReverseOfActivation() throws Exception {
    LifecycleInjector injector = InjectorBuilder.fromModules(new ContainerEventBusModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(TitusRuntime.class).toInstance(TitusRuntimes.internal());
            bind(ActivationProvisionListenerTest.class).toInstance(ActivationProvisionListenerTest.this);
            bind(ServiceB.class).asEagerSingleton();
            bind(ServiceA.class).asEagerSingleton();
        }
    }).createInjector();
    ActivationLifecycle activationLifecycle = injector.getInstance(ActivationLifecycle.class);
    activationLifecycle.activate();
    activationLifecycle.deactivate();
    assertThat(activationTrace).hasSize(4);
    String firstActivated = activationTrace.get(0).getLeft();
    String secondActivated = activationTrace.get(1).getLeft();
    assertThat(activationTrace.subList(2, 4)).containsExactly(Pair.of(secondActivated, "DEACTIVATED"), Pair.of(firstActivated, "DEACTIVATED"));
}
Also used : ContainerEventBusModule(com.netflix.titus.common.util.guice.ContainerEventBusModule) ActivationLifecycle(com.netflix.titus.common.util.guice.ActivationLifecycle) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) LifecycleInjector(com.netflix.governator.LifecycleInjector) AbstractModule(com.google.inject.AbstractModule) Test(org.junit.Test)

Example 3 with ContainerEventBusModule

use of com.netflix.titus.common.util.guice.ContainerEventBusModule in project titus-control-plane by Netflix.

the class TitusRuntimeModule method configure.

@Override
protected void configure() {
    // Framework services
    install(new ContainerEventBusModule());
    install(new JHiccupModule());
    bind(SystemLogService.class).to(LoggingSystemLogService.class);
    bind(SystemAbortListener.class).to(LoggingSystemAbortListener.class);
    bind(FitActionInitializer.class).asEagerSingleton();
}
Also used : ContainerEventBusModule(com.netflix.titus.common.util.guice.ContainerEventBusModule) SystemAbortListener(com.netflix.titus.common.runtime.SystemAbortListener) LoggingSystemAbortListener(com.netflix.titus.common.runtime.internal.LoggingSystemAbortListener) SystemLogService(com.netflix.titus.common.runtime.SystemLogService) LoggingSystemLogService(com.netflix.titus.common.runtime.internal.LoggingSystemLogService) JHiccupModule(com.netflix.titus.common.jhiccup.JHiccupModule)

Example 4 with ContainerEventBusModule

use of com.netflix.titus.common.util.guice.ContainerEventBusModule in project titus-control-plane by Netflix.

the class TitusGatewayModule method configure.

@Override
protected void configure() {
    bind(Archaius2ConfigurationLogger.class).asEagerSingleton();
    bind(Registry.class).toInstance(new DefaultRegistry());
    bind(SystemLogService.class).to(LoggingSystemLogService.class);
    bind(SystemAbortListener.class).to(LoggingSystemAbortListener.class);
    bind(Fabric8IOConnector.class).to(DefaultFabric8IOConnector.class).asEagerSingleton();
    install(new ContainerEventBusModule());
    install(new TitusContainerRegistryModule());
    install(new TitusEntitySanitizerModule());
    install(new TitusAdmissionModule());
    install(new JobSecurityValidatorModule());
    // Feature flags
    install(new FeatureFlagModule());
    install(new GatewayEndpointModule(enableREST));
    install(new TitusMasterConnectorModule());
    install(new JobManagerConnectorModule(JobEventPropagationUtil.CHECKPOINT_GATEWAY_CLIENT));
    install(new JobManagerDataReplicationModule());
    install(new EvictionConnectorModule());
    install(new RelocationClientConnectorModule());
    install(new RelocationDataReplicationModule());
    bind(V3_LOG_STORAGE_INFO).toInstance(EmptyLogStorageInfo.INSTANCE);
    install(new V3ServiceModule());
    install(new StoreModule());
}
Also used : Archaius2ConfigurationLogger(com.netflix.titus.common.util.archaius2.Archaius2ConfigurationLogger) SystemAbortListener(com.netflix.titus.common.runtime.SystemAbortListener) LoggingSystemAbortListener(com.netflix.titus.common.runtime.internal.LoggingSystemAbortListener) JobManagerConnectorModule(com.netflix.titus.runtime.connector.jobmanager.JobManagerConnectorModule) GatewayEndpointModule(com.netflix.titus.gateway.endpoint.GatewayEndpointModule) TitusMasterConnectorModule(com.netflix.titus.runtime.connector.titusmaster.TitusMasterConnectorModule) SystemLogService(com.netflix.titus.common.runtime.SystemLogService) LoggingSystemLogService(com.netflix.titus.common.runtime.internal.LoggingSystemLogService) TitusContainerRegistryModule(com.netflix.titus.runtime.connector.registry.TitusContainerRegistryModule) RelocationClientConnectorModule(com.netflix.titus.runtime.connector.relocation.RelocationClientConnectorModule) DefaultFabric8IOConnector(com.netflix.titus.runtime.connector.kubernetes.fabric8io.DefaultFabric8IOConnector) StoreModule(com.netflix.titus.gateway.store.StoreModule) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) Registry(com.netflix.spectator.api.Registry) ContainerEventBusModule(com.netflix.titus.common.util.guice.ContainerEventBusModule) TitusAdmissionModule(com.netflix.titus.runtime.endpoint.admission.TitusAdmissionModule) EvictionConnectorModule(com.netflix.titus.runtime.connector.eviction.EvictionConnectorModule) V3ServiceModule(com.netflix.titus.gateway.service.v3.V3ServiceModule) JobSecurityValidatorModule(com.netflix.titus.runtime.endpoint.admission.JobSecurityValidatorModule) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) JobManagerDataReplicationModule(com.netflix.titus.runtime.connector.jobmanager.JobManagerDataReplicationModule) FeatureFlagModule(com.netflix.titus.runtime.FeatureFlagModule) RelocationDataReplicationModule(com.netflix.titus.runtime.connector.relocation.RelocationDataReplicationModule) TitusEntitySanitizerModule(com.netflix.titus.runtime.TitusEntitySanitizerModule)

Example 5 with ContainerEventBusModule

use of com.netflix.titus.common.util.guice.ContainerEventBusModule in project titus-control-plane by Netflix.

the class ActivationProvisionListenerTest method testServiceReordering.

@Test
public void testServiceReordering() throws Exception {
    LifecycleInjector injector = InjectorBuilder.fromModules(new ContainerEventBusModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(TitusRuntime.class).toInstance(TitusRuntimes.internal());
            bind(ActivationProvisionListenerTest.class).toInstance(ActivationProvisionListenerTest.this);
            bind(ServiceB.class).asEagerSingleton();
            bind(ServiceA.class).asEagerSingleton();
        }
    }).createInjector();
    ActivationLifecycle activationLifecycle = injector.getInstance(ActivationLifecycle.class);
    activationLifecycle.activate();
    assertThat(activationTrace).containsExactlyInAnyOrder(Pair.of("serviceA", "ACTIVATED"), Pair.of("serviceB", "ACTIVATED"));
}
Also used : ContainerEventBusModule(com.netflix.titus.common.util.guice.ContainerEventBusModule) ActivationLifecycle(com.netflix.titus.common.util.guice.ActivationLifecycle) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) LifecycleInjector(com.netflix.governator.LifecycleInjector) AbstractModule(com.google.inject.AbstractModule) Test(org.junit.Test)

Aggregations

ContainerEventBusModule (com.netflix.titus.common.util.guice.ContainerEventBusModule)8 AbstractModule (com.google.inject.AbstractModule)5 ActivationLifecycle (com.netflix.titus.common.util.guice.ActivationLifecycle)5 LifecycleInjector (com.netflix.governator.LifecycleInjector)4 TitusRuntime (com.netflix.titus.common.runtime.TitusRuntime)4 SystemAbortListener (com.netflix.titus.common.runtime.SystemAbortListener)3 SystemLogService (com.netflix.titus.common.runtime.SystemLogService)3 LoggingSystemAbortListener (com.netflix.titus.common.runtime.internal.LoggingSystemAbortListener)3 LoggingSystemLogService (com.netflix.titus.common.runtime.internal.LoggingSystemLogService)3 Test (org.junit.Test)3 DefaultRegistry (com.netflix.spectator.api.DefaultRegistry)2 Registry (com.netflix.spectator.api.Registry)2 Archaius2ConfigurationLogger (com.netflix.titus.common.util.archaius2.Archaius2ConfigurationLogger)2 TitusEntitySanitizerModule (com.netflix.titus.runtime.TitusEntitySanitizerModule)2 Injector (com.google.inject.Injector)1 GovernatorJerseySupportModule (com.netflix.governator.guice.jersey.GovernatorJerseySupportModule)1 JHiccupModule (com.netflix.titus.common.jhiccup.JHiccupModule)1 FederationEndpointModule (com.netflix.titus.federation.endpoint.FederationEndpointModule)1 CellConnector (com.netflix.titus.federation.service.CellConnector)1 CellInfoResolver (com.netflix.titus.federation.service.CellInfoResolver)1