You ultimate goal will be to create two services, service A and service B, and use a messaging system to connect them to single business process.
- Service A will send messages to service B
- Service B will track a balance containing money in some storage. It will receive messages from service A and add to the balance accordingly.
- Services have no concept of "users", and this kind of development is not necessary for task at hand.
- No authentication is necessary on any of the services
- "EUR" should be the only supported currency in this initial version.
- Both services must be documented with README.md files explaining following, project purpose, how to setup it, how to run it.
- Services as docker containers
- Unit test
- Handling concurrent messages on Service B
Service A has two task:
- Accept HTTP request that carry money information
- Generate AMQP messages towards "Service B"
- HTTP API must be able to accept following HTTP payload:
{
"amount": 1123.4,
"currency": "EUR",
}
- Amount is sent as decimal representation.
- Amount property must not be lower than -100000000 EUR, and larger than +100000000 EUR.
- Valid requests must generate HTTP/200 requests
- Invalid requests must generate HTTP/400 responses
- HTTP API must be documented via projects README.md
- Messaging API must generate valid messages for Service B to consume after HTTP api described above is invoked.
- All Messaging infrastructure (except definitions necessary for service B to consume messages) must be defined as part of service A
- Example message sent over message broker:
{
"amount": 112304,
"currency": "EUR",
}
- Amount is sent as minimal currency denomination representation (e.g. cents, this means that 1 EUR is sent as amount 100, and 100.19 EUR is sent as amount 10019)
- Language: PHP, Java, golang
- Messaging: Any AMQP broker (e.g. Rabbit MQ)
- Service accepts AMQP messages generated by Service A
- Service must have account entity stored in database, described by two properties, balance and updatedAt
- Initial balance must be set at 0
- Initial updatedAt must be set at NULL
As a result of each message processing, following must happen:
- Balance must increased or decreased based on amount property
- updatedAt property must be updated so that it reflect last balance change
- HTTP API must have single route that exposes state of balance
- Language: PHP, Java, golang
- Storage: Mariadb/Mysql, PostgreSql
If this project help you reduce time to develop, you can give me a cup of coffee :)