# Game Rental Application
## Description
The "Game Rental" application showcases how [Axon Framework](https://github.com/AxonFramework/AxonFramework)
and [Axon Server](https://developer.axoniq.io/axon-server/overview) or [AxonIQ Cloud](https://cloud.axoniq.io/) can be used during software development.
The domain focused on is that of rental services from the perspective of a video game store.
This repository provides just such an application, albeit a demo rather than a full-fledged solution.
It serves the personal purpose of having a stepping stone application to live code during application.
I intend to build upon this sample during consecutive talks, further enhancing its capabilities and implementation as time progresses.
For others, I hope this provides a quick and straightforward look into what it means to build an Axon-based application.
Due to its nature of being based on Axon, it incorporates [DDD](https://developer.axoniq.io/domain-driven-design/overview),
[CQRS](https://developer.axoniq.io/cqrs/overview), [Event Sourcing](https://developer.axoniq.io/event-sourcing/overview),
and an overall message-driven solution to communicate between distinct components.
> **Demo Recordings with different Game Rental implementations**
>
> Since I aim to use this project for some time, it'll change through its lifecycle.
> Most notably, I'll keep it up to date with recent versions of the dependencies.
>
> Due to this, recordings from previous iterations of this project will likely show slight deviations.
> However, the taken steps during those recordings will remain intact.
## Project Traversal
Distinct branches will be (made) available per public speaking, sharing a start and final solution branch separately.
Additionally, several branches representing the steps throughout the lifecycle of the "Game Rental" application will be present, allowing you to:
* Check out the exact step that interest you.
* Perform a `git reset --hard step#` to reset your current branch.
Next to providing the convenience of showing the flow, it also serves as a backup during the presentation.
This project currently contains the following steps:
1. The `core-api`, containing the commands, events, queries, and query responses.
2. The `command` model has been created, showing a `Game` aggregate.
3. The application connects to [AxonIQ Cloud](https://console.cloud.axoniq.io/) through the added [Axon Server](https://developer.axoniq.io/axon-server/overview) properties in the `application.properties`.
4. The `query` model, a `GameView`, is provided, created/updated, and made queryable through the `GameCatalogProjector`.
5. This step includes the [Reactor Extension](https://github.com/AxonFramework/extension-reactor), which is used by the `GameRentalController`.
6. This step introduces cleaner distributed exceptional handling. It does so by throwing specifics exceptions in `@ExceptionHandler` annotated functions in the `Game` aggregate and `GameCatalogProjector`, containing an `ExceptionStatusCode`.
7. Spring's `@Profile{{profile-name})` annotation has been added to the `Game`, `GameCatalogProjector`, `GameViewRepository` and `GameRentalController`, allowing for application distribution.
8. Preparation to introduce another endpoint based on RSocket, by renaming the controller to contain "rest" in the name and by extracting the exception mapping registration.
9. Introduce the `GameRentalRSocketController`, providing an entry point to the application using [RSocket](https://rsocket.io/).
## Running and testing the application
As this is a Spring Boot application, simply running the `GameRentalApplication` is sufficient.
However, Spring profiles are present, which allow for running portions of this application.
More specifically, there's a `command`, `query`, and `ui` profile present, thus segregating the `Game` aggregate, `GameCatalogProjector`, and `GameRentalController` into their separate runnables.
Furthermore, when you use IntelliJ, you can use the "Run Configurations" from the `./.run` to speed up the startup process.
The application does expect it can make a connection with an Axon Server instance.
Ideally, [Axon Cloud](https://console.cloud.axoniq.io/) is used for this, as is shown in step 3.
If you desire to run Axon Server locally, you can download it [here](http://download.axoniq.io/quickstart/AxonQuickstart.zip).
> **Unit Tests**
>
> Any new components introduced in a step include unit tests.
> These can be used to better understand the project.
For validating the application's internals, you can run the tests, use the REST endpoint, or connect with the [RSocket](https://rsocket.io/) endpoint.
When testing through the REST endpoint, [IntelliJ Ultimate](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html) you can use the included `.http` files (in the root folder of this project).
The `register-games.http` allows for the registration of several games to build a base catalog.
The `other-requests.http` file contains all other operations for testing.
When testing through RSocket, the most straightforward approach is to install the [RSocket Client CLI](https://github.com/making/rsc), or `rsc` for short.
The README of `rsc` provides concrete explanations on how to install it in your environment.
With `rsc` in place, you can use the following commands to test the application:
* Register a game - `rsc --debug --request --route register --data="{\"gameIdentifier\":\"8668\",\"title\":\"Hades\",\"releaseDate\":\"2020-09-17T00:00:01.000009Z\",\"description\":\"Roguelike dungeon crawler set in ancient Greek mythology\",\"singleplayer\":true,\"multiplayer\":false}" tcp://localhost:7000`
* Rent a game - `rsc --debug --fnf --route rent --data="{\"gameIdentifier\":\"8668\",\"renter\":\"Ben Wilcock\"}" tcp://localhost:7000`
* Return a game - `rsc --debug --fnf --route return --data="{\"gameIdentifier\":\"8668\",\"renter\":\"Ben Wilcock\"}" tcp://localhost:7000`
* Find a game - `rsc --debug --request --route find --data="8668" tcp://localhost:7000`
* Watch the game catalog - `rsc --debug --stream --route catalog tcp://localhost:7000`
## Starting your own Axon project
The [steps](#project-traversal) this project traverses show a common approach towards constructing an Axon application. If you want to begin from scratch, consider these key aspects:
* Use the [AxonIQ Initializr](https://start.axoniq.io/) to kick-start your project.
* Use [Axon Cloud Console](https://console.cloud.axoniq.io/) to connect your application to a context.
Using Axon Cloud allows you to persist your events and distributed commands, events, and queries.
* Whenever anything is unclear, check out the [Reference Guide](https://docs.axoniq.io/reference-guide/) or drop a question on the [forum](https://discuss.axoniq.io/).
没有合适的资源?快使用搜索试试~ 我知道了~
作为 Axon 展示 的Game Rental 应用程序示例项目_java_代码_下载
共47个文件
java:30个
xml:6个
properties:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 180 浏览量
2022-06-23
11:49:02
上传
评论
收藏 90KB ZIP 举报
温馨提示
“游戏租赁”应用程序展示了如何在软件开发过程中使用Axon Framework 和Axon Server或AxonIQ Cloud 。重点关注的领域是从视频游戏商店的角度来看的租赁服务。 这个存储库提供了这样一个应用程序,尽管是一个演示而不是一个完整的解决方案。它的个人目的是在应用程序期间为实时代码提供垫脚石应用程序。我打算在连续会谈中以这个样本为基础,随着时间的推移进一步增强它的能力和实施。对于其他人,我希望这可以快速而直接地了解构建基于 Axon 的应用程序意味着什么。 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
gamerental-main.zip (47个子文件)
gamerental-main
.gitignore 395B
other-requests.http 2KB
.run
Game Rental Application - All.run.xml 883B
Game Rental Application - Query Side.run.xml 871B
Game Rental Application - Command Side.run.xml 875B
Game Rental Application - UI.run.xml 860B
Game Rental Application - RSocket.run.xml 870B
.mvn
wrapper
MavenWrapperDownloader.java 5KB
maven-wrapper.jar 50KB
maven-wrapper.properties 218B
README.md 7KB
pom.xml 4KB
register-games.http 3KB
mvnw 10KB
src
test
resources
application.properties 77B
java
io
axoniq
demo
gamerental
query
GameCatalogProjectorTest.java 7KB
controller
GameRentalRSocketControllerTest.java 5KB
GameRentalRestControllerTest.java 6KB
TestUtils.java 960B
command
GameTest.java 4KB
ExceptionMapperTest.java 2KB
main
resources
application-rsocket.properties 31B
application.properties 537B
java
io
axoniq
demo
gamerental
coreapi
ExceptionStatusCode.java 825B
GameRentedEvent.java 1KB
Game.java 2KB
RentalCommandException.java 319B
RentalQueryException.java 309B
FullGameCatalogQuery.java 216B
ReturnGameCommand.java 1KB
FindGameQuery.java 1001B
RegisterGameCommand.java 3KB
GameReturnedEvent.java 1KB
RentGameCommand.java 1KB
GameRegisteredEvent.java 3KB
ApplicationConfig.java 4KB
ExceptionMapper.java 1KB
query
GameCatalogProjector.java 4KB
GameViewRepository.java 252B
GameView.java 3KB
ResultHandlerConfig.java 902B
GameRentalApplication.java 337B
controller
GameRentalRestController.java 3KB
GameRentalRSocketController.java 3KB
GameDto.java 3KB
command
Game.java 4KB
mvnw.cmd 6KB
共 47 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功