Simple demo app to use reactive functionality to consume some endpoints and store them in mongodb
Idea behind this is to execute some steps in following order:
- Receives a transaction request that contains a Post Id to search
- Stores an initial record in mongodb
- Call an Endpoint to get information for Post
- Update post information in database
- Call an Endpoint to get Information for first Photo for a UserId (from retrieved Post)
- Update photo information in database
- Return Stored information in database
There are two implementations to achieve above steps:
Implements functionality using private methods to call each step
// TransactionService#manageTransaction calls each private method
private Mono<Transaction> manageTransaction(Transaction transaction) Implements functionality with out using private methods all steps are inside
//TransService#manageTransaction do all steps in this single metho
private Mono<Transaction> manageTransaction(Transaction transaction) Any feedback is welcome
http://localhost:8080/api/v1/transactions
post body:
{
"postId":24
}Response should be similar to
{
"id": "5d1b1f5e54031f17dc1d482f",
"status": "Created",
"postId": 24,
"creationTime": "2019-07-02T04:09:50.274",
"postAtTime": "2019-07-02T04:09:54.954",
"photoAtTime": "2019-07-02T04:09:55.03",
"post": {
"id": 24,
"userId": 3,
"title": "autem hic labore sunt dolores incidunt",
"body": "enim et ex nulla\nomnis voluptas quia qui\nvoluptatem consequatur numquam aliquam sunt\ntotam recusandae id dignissimos aut sed asperiores deserunt"
},
"photo": {
"id": 21,
"userId": 3,
"title": "repudiandae voluptatem optio est consequatur rem in temporibus et"
}
}