Reactive ScalaJdbc with Flyway Play


  1. Postgres Driver /
  2. Flyway to add reactive non-blocking: flyway/flyway-play (play 2.4 +)/
  3. Scalikejdbc-async here
  4. Edit conf/application.conf add
play.modules.enabled += "org.flywaydb.play.PlayModule"
  1. postgresql-async (More and in depth analysis here)

Add in conf/application.conf

# https://www.playframework.com/documentation/latest/Configuration
play.modules.enabled += "org.flywaydb.play.PlayModule"

# https://www.playframework.com/documentation/latest/Configuration

# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://locahost:5432/playapp"
db.default.username=postgres
db.default.password=sa

logger.scalikejdbc=DEBUG

# ScalikeJDBC original configuration
#db.default.poolInitialSize=10
#db.default.poolMaxSize=10
#db.default.poolValidationQuery=

scalikejdbc.global.loggingSQLAndTime.enabled=true
scalikejdbc.global.loggingSQLAndTime.singleLineMode=false
scalikejdbc.global.loggingSQLAndTime.logLevel=debug
scalikejdbc.global.loggingSQLAndTime.warningEnabled=true
scalikejdbc.global.loggingSQLAndTime.warningThresholdMillis=5
scalikejdbc.global.loggingSQLAndTime.warningLogLevel=warn

play.modules.enabled += "scalikejdbc.PlayModule"

 

  1. Implement SuperMail model
  2. Create REST endpoints
  3. Add to routes
GET        /bars:username                   controllers.Application.getSuperMails(username: String)
POST       /bars                   controllers.Application.createSuperMail

 

  1. Implement Controller
  2. Test

Original reactive post here.

More details to handle request here (Official lightbend)

Etiquetas: , ,

About martincx

Fútbol, cine, historia y literatura. Quejándome del fútbol moderno.

Este blog se enriquece con los comentarios, deja acá tu impresión.

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: