We are working on a number of microservices which are part of a multi-module Java Spring Boot project. The project is structured a little bit like this example: [login to view URL]
## Microservice #1: Config Service ##
This application handles requests for pre-saved configuration objects stored in a database. They contain parameters for other microservices. For the Active User Count Service, there exists for example a default ActiveUserCountConfig object which can be fetched using its profile ID. This should be defined in the [login to view URL] file of the application fetching a config. At the moment, it is hard-coded in a rest consumption URI.
Logic used: - Rest controller GetMapping end point: /getActiveUserConfig. Query param: profileId (integer). Calidate profileId matches document field profileId in ActiveUserConfig collection. If match found, return MATCH.activeUserConfig. If no match found, return a default ActiveUserConfig.
## Microservice #2: Active User Count Service ##
The intention is for this microservice to query a MongoDB cloud instance with a certain frequency (e.g. every Y seconds) in order to find out how many users were active within the last X seconds. This information can then be sent to clients and other microservices through a @GetMapping structure within a RestController class. These requests will be frequent, but only an approximate count of the number of users online is required. Hence, we do not want to overwhelm the database with unnecessary queries when instead we can refresh the value of a variable within the microservice every so often. The values for X and Y will be retrieved by querying a separate microservice which supplies configuration objects.
Initialise AUC service with consuming rest request to Config Service to retrieve a config object as defined in Active User Count Service application.properties.
Config object will contain following parameters:
Background thread: Loop every `interval` (Y) seconds, count number of documents in UserProfile collection where document field lastPingTime is greater than current time minus `tMinus` (X) seconds. Construct an ActiveUserCountResult object which contains both query results and parameters and save this to a dedicated collection in the database. Save the count in memory for access by rest controller.
Rest controller: GetMapping end point /getActiveUserCount - return current count value as determined by background thread above.
## Microservice #3: User Activity Logging Service
This application logs when a user was last active. It should include a REST controller which receives a post request that contains a document ID for a UserProfile. It should then construct a UserProfileLite object. It should then compare the lastpingtime of the UserProfileLite object with the current system time. If the current system time exceeds that of the constructed UserProfileLite object, lookup using the ID and update the mathcing UserProfile document in the database with the current system time. Note that UserProfile is an extension of UserProfileLite. UserProfile should be the class that matches the document, but UserProfileLite exists and contins fewer properties so as to allow for a reduced memory footprint in the business logic. See code for better illustration.
Please see attached brief document for scheme of work and attached Java project for a partially completed version of the code.
Hi Greetings! I have profound experience and expertise working with MSA for various requirements. I believe I can service you with utmost quality with junits and performing functions. Thanks Madiraju
14 freelancers are bidding on average £193 for this job
Hi, I'm Asiri, working as a Software Engineer and I would like to help you. Please check my reputation on google. [login to view URL] Let's discuss more on chat. Thanks & regards
Am expert java developer with more than 13+ experience in development of applications, microservices, web services, rest services etc. These use cases are very interesting and will be able to deliver in specified time.