且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要使用Play Framework 2.1.1和AKKA实现服务器端计时器

更新时间:2023-11-27 21:52:22

我想您可以从Play框架附带的Java Comet Clock示例中获得启发

I guess you can get inspiration from the Java Comet Clock sample coming with Play framework

https://github.com/playframework/Play20/tree/master/samples/java/comet-clock

它使用Akka进行调度,并使用Comet将数据推送到客户端.也许您可以使用更好的推送解决方案,例如websockets或服务器发送的事件(您可以查看websocket聊天示例)

It use Akka for scheduling and Comet to push data to clients. Maybe your can use a better push solution like websockets or server sent events (you can check the websocket chat sample for that)

如果需要将计时器存储在数据库中,则可以在Clock Actor(或等效功能)中进行.

And if you need to store the timer in a DB, you can do that in the Clock Actor (or equivalent).