-
Notifications
You must be signed in to change notification settings - Fork 0
Example: Parcel tracker
Esta Nagy edited this page Jan 24, 2021
·
2 revisions
This example application is inspired by the parcel tracking feature which is used by the Hungarian Post Office. The website allows users to search for 10 parcels at a time.
The imaginary example code is using a similar setup asking a question: "What if you needed to cache something similar?"
The request in this case is only a collection of Strings (parcel Ids) while the response uses objects containing both the Id and a made up status that could resemble a real delivery scenario. The rest of the parcel metadata is intentionally omitted as the caching won't really behave differently by having them but they would make the example harder to understand.
Please find the example code here and consider the following notes as hints:
- This is the origin service method we want to cache: ParcelService#lookup(List)
- These are the transformers
- for the requests: ParcelBatchRequestTransformer
- for the response: ParcelBatchResponseTransformer
- The caching is turned off for this test case, therefore the related class is more or less useless
- The configuration of the batch caller (calling the origin service) is defined by ParcelBatchServiceCaller