Details
-
Story
-
Status: Closed
-
Medium
-
Resolution: Done
-
None
Description
Scope of this user story: Response Message format, forwarding to client Topic (or CPS broadcast topic for now)
https://www.baeldung.com/spring-webclient-resttemplate
Currently we are using RestTemplate that can be replaced by WebClient. RestTemplate uses Java Servlet API and is therefore synchronous and blocking. Contrarily, WebClient is asynchronous and will not block the executing thread while waiting for the response to come back.
Spring WebClient vs. RestTemplate
RestTemplate uses Java Servlet API and is therefore synchronous and blocking. Contrarily, WebClient is asynchronous and will not block the executing thread while waiting for the response to come back. Only when the response is ready will the notification be produced.
RestTemplate will still be used. The non-blocking approach uses much fewer system resources compared to the blocking one. Hence, WebClient is a preferable choice.
A/C
- Agree use of WebClient
- Correctly formatted message (agree with team and stakeholder first) incl.
- Message/Request ID
- Original client topic
- Response payload
- Message gets forwarded to original Client Topic
- agree client response format (See spike)
- Contact kieranmccarthy
- Note: Try keep it as similar on m2m topic and client topic
- agree client response format (See spike)
- Message can be seen on client topic with correct information
Out of scope
- DMI Plugin will still follow synchronous process but also send async response
- e2e testing and CSIT (CPS-833)
Testing Steps
- Add request via
- Publish message to NCMP or
- Directly call method/API to invoke async operation
- Monitor logs in NCMP & DMI for activity
- Monitor m2m topic for message and verify correct information
- Monitor client topic for message and verify correct information