Two Laptop Bag
The moose likes Scala and the fly likes newbie Play question - have some experience with Java but this is my first Play app Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Languages » Scala
Reply Bookmark "newbie Play question - have some experience with Java but this is my first Play app" Watch "newbie Play question - have some experience with Java but this is my first Play app" New topic
Author

newbie Play question - have some experience with Java but this is my first Play app

karthik raghunathan
Greenhorn

Joined: Nov 12, 2011
Posts: 7
Hi,

I need to poll a db regularly (30sec) to read a field and route requests accordingly.

How do I implement this in Play ?

My first attempt was to use a Thread to read the db and update a static member in the controller.
This strikes me as The Wrong Thing To Do(TM).

I found two classes - the Play Global application object and the Jobs object -
the idea being the field would be in the Globals class and the Job would run @Every("30s"), but I don't seem to be able to find play.jobs in version 2.x (documentation is for 1.0 and 1.2) ...

Also the global object is defined in the root package and cannot be accessed from 'package controllers' or 'package myapp'

If I were to get Akka to do this, who would trigger the Akka call ?

Has anyone handled something like this before ? Am I missing anything big here ?

Thanks in advance
Karthik
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: newbie Play question - have some experience with Java but this is my first Play app
 
Similar Threads
DB File Insert Values
Data Serialization
Need to save a response , before sending it th the client
Which New Programming Language To Learn
Oracle imports