Console scala app doesn't stop when using reactive mongo driver -
i'm playing mongo database through reactive mongo driver
import org.slf4j.loggerfactory import reactivemongo.api.mongodriver import reactivemongo.api.collections.default.bsoncollection import reactivemongo.bson.bsondocument import scala.concurrent.future import scala.concurrent.duration._ import scala.concurrent.executioncontext.implicits.global object main { val log = loggerfactory.getlogger("main") def main(args: array[string]): unit = { log.info("start") val conn = new mongodriver().connection(list("localhost")) val db = conn("test") log.info("done") } }
my build.sbt
file:
lazy val root = (project in file(".")). settings( name := "simpleapp", version := "1.0.0", scalaversion := "2.11.4", librarydependencies ++= seq( "org.reactivemongo" %% "reactivemongo" % "0.10.5.0.akka23", "ch.qos.logback" % "logback-classic" % "1.1.2" ) )
when run: sbt compile run
i output:
$ sbt compile run [success] total time: 0 s, completed apr 25, 2015 5:36:51 pm [info] running main error statuslogger no log4j2 configuration file found. using default configuration: logging errors console. 17:36:52.328 [run-main-0] info main - start 17:36:52.333 [run-main-0] info main - done
and application doesn't stop.... :/
i have press ctrl + c kill it
i've read mongodriver()
creates actorsystem
tried close connection manually conn.close()
this:
[info] running main error statuslogger no log4j2 configuration file found. using default configuration: logging errors console. 17:42:23.252 [run-main-0] info main - start 17:42:23.258 [run-main-0] info main - done 17:42:23.403 [reactivemongo-akka.actor.default-dispatcher-2] error reactivemongo.core.actors.mongodbsystem - (state: closing) unhandled message: channelconnected(-973180998) [info] [04/25/2015 17:42:23.413] [reactivemongo-akka.actor.default-dispatcher-3] [akka://reactivemongo/deadletters] message [reactivemongo.core.actors.closed$] actor[akka://reactivemongo/user/$b#-1700211063] actor[akka://reactivemongo/deadletters] not delivered. [1] dead letters encountered. logging can turned off or adjusted configuration settings 'akka.log-dead-letters' , 'akka.log-dead-letters-during-shutdown'. [info] [04/25/2015 17:42:23.414] [reactivemongo-akka.actor.default-dispatcher-3] [akka://reactivemongo/user/$a] message [reactivemongo.core.actors.close$] actor[akka://reactivemongo/user/$b#-1700211063] actor[akka://reactivemongo/user/$a#-1418324178] not delivered. [2] dead letters encountered. logging can turned off or adjusted configuration settings 'akka.log-dead-letters' , 'akka.log-dead-letters-during-shutdown'.
and app doesn't exit also
so, doing wrong? can'f find answer...
and seems me official docs doesn't explain whether should care graceful shutdown @ all.
i don't have experience console apps, use play framework in projects want create sub-project works mongodb
i see many templates (in activator) such as: play + reactive mongo, play + akka + mongo there's no scala + reactive mongo explain how work :/
this looks known issue reactive mongo, see relevant thread on github
a fix introduced in pull request #241 reid-spencer, merged on 3rd of february 2015
you should able fix using newer version. if no release has been made since february, try checking out version includes fix , building code yourself.
as far can see, there's no mention of bugfix in release notes version 0.10.5
- bugfixes:
- bson library: fix bsondatetimenumberlike typeclass
- cursor: fix exception propagation
- commands: fix ok deserialization cases
- commands: fix collstatsresult
- commands: fix addtoset in aggregation
- core: fix connection leak in cases
- genericcollection: not ignore writeconcern in save()
- genericcollection: not ignore writeconcern in bulk inserts
- gridfs: fix uploaddate deserialization field
- indexes: fix parsing ascending , descending
- macros: fix type aliases
- macros: allow custom annotations
the name of committer not appear well:
here list of commits included in release (since 0.9, top commit recent one):
$ git shortlog -s -n refs/tags/v0.10.0..0.10.5.x.akka23 39 stephane godbillon 5 andrey neverov 4 lucasrpb 3 faissal boutaounte 2 杨博 (yang bo) 2 nikolay sokolov 1 david liman 1 maksim gurtovenko 1 age mooij 1 paulo "jcranky" siqueira 1 daniel armak 1 viktor taranenko 1 vincent debergue 1 andrea lattuada 1 pavel.glushchenko 1 jacek laskowski
looking @ commit history 0.10.5.0.akka23
(the 1 reference in build.sbt
), seems fix not merged it.
Comments
Post a Comment