All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.app.cash.backfila.service.selfbackfill.LocalBackfillingModule.kt Maven / Gradle / Ivy

package app.cash.backfila.service.selfbackfill

import app.cash.backfila.client.BackfilaCallbackConnectorProvider
import app.cash.backfila.client.BackfilaClientConfig
import app.cash.backfila.client.BackfilaClientLoggingSetupProvider
import app.cash.backfila.client.BackfilaClientNoLoggingSetupProvider
import app.cash.backfila.client.ForConnectors
import app.cash.backfila.client.internal.BackfilaClient
import app.cash.backfila.client.misk.hibernate.HibernateBackfillModule
import app.cash.backfila.client.misk.internal.BackfilaStartupService
import app.cash.backfila.service.persistence.BackfilaDb
import misk.ServiceModule
import misk.inject.KAbstractModule
import misk.jdbc.SchemaMigratorService

// Connector type used only by backfila to backfill itself.
private const val LOCAL = "LOCAL"

class LocalBackfillingModule : KAbstractModule() {
  override fun configure() {
    install(
      ServiceModule()
        .dependsOn(BackfilaDb::class),
    )

    bind(BackfilaClientConfig::class.java).toInstance(
      BackfilaClientConfig(
        slack_channel = null,
        connector_type = LOCAL,
        connector_extra_data = "",
        variant = null,
      ),
    )

    newMapBinder(ForConnectors::class)
      .addBinding(LOCAL)
      .to(LocalCallbackConnectorProvider::class.java)

    bind(BackfilaClient::class.java).to(LocalBackfilaClient::class.java)
    bind(BackfilaClientLoggingSetupProvider::class.java)
      .to(BackfilaClientNoLoggingSetupProvider::class.java)

    install(HibernateBackfillModule.create())
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy