构建 Play 框架模块以在多个服务之间共享数据层
牢记 SOA 的概念,我的目的是提供几种不同的服务,它们利用相同的数据模型。想象一个扑克应用程序 - 我们可能有以下服务:
- 游戏前端
- 管理前端
- 玩家排名/排行榜服务
- 玩家财务服务
- 银行集成服务
- ...
所有这些服务都可以利用相同的模型(也许在必要时提供额外的模型信息)。
在剧中!框架,我是否可以外部化这个数据模型,但保持我们从使用 Play 中获得的好处。例如,运行时重新编译。
模块似乎可以完成这项工作,但是关于它们的文档很少,并且给出的示例表明了相反的范例 - 其中服务是模块,核心游戏应用程序引入了功能。
任何指导将不胜感激。
Keeping the notion of a SOA in mind, my intent is to provide several different services, which leverage the same data model. Imagine a poker application - we may have the following services:
- Game frontend
- Administrative frontend
- Player rank / leaderboard service
- Player finances service
- Bank integration service
- ...
All of these services can leverage the same model (perhaps providing additional model information where neccessary).
In the Play! framework, is it possible for me to externalize this data model, but maintain the benefits we gain from using Play. For example, runtime re-compilation.
Modules seem like they might serve the job, but there is little documentation about them, and the examples given suggest the opposite paradigm - where services are the modules, and the core play application pulls in features.
Any guidance would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Play 很难获得真正的 SOA 风格。因为 Play 不仅仅是一个框架 - 它是一个 Web 平台,提供从 HTTPRequest 到数据库持久性的服务,而不是孤立的。
在你的情况下,如果你必须真正外部化数据层,那么我建议你尝试 弹簧模块。
Spring 应该负责持久性、业务逻辑并将其封装在服务接口中。
在您的 Play 应用程序中,控制器依赖于这些公开的服务接口。 Spring 服务应该独立于任何 Play 功能(无论是验证还是 JPA 持久性等,即不导入)
目标是 - 如果需要的话,您应该能够使用任何 MVC 框架(Spring MVC、Struts 等)并且使用相同的服务。
It's hard to get a true SOA style using Play. Because Play is not just a framework - it's a web platform providing services right from HTTPRequest to Database persistence and not in isolation.
In your case, if you have to truly externalize data-layer- then I would suggest you try Spring module.
Spring should take care of Persistence, business logic and encapsulate this in Service Interfaces.
In your Play app, the controller depends on these exposed Service Interfaces. Spring services should be in-dependent on any Play features (be it for validation or JPA persistence etc. i.e. no imports)
The objective is - tommo if required, you should be able to use any MVC framework (Spring MVC, Struts etc) and utilize the same services.
我正在尝试类似的事情。
我要尝试的是
理论上,我应该能够通过在 Eclipse 中配置构建命令来调用播放命令,这样我就可以自动构建供主应用程序使用的模块。
希望这对我有用......
I'm attempting something similar.
What I am about to attempt is
Theoretically I should be able to call play commands by configuring the build commands in Eclipse so this should allow me to automatically build the modules for the main app to use.
Hopefully this will work for me...