INTERLOK-3912 Producer now uses the synch client rather than asynch. #1003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
We have recently had an issue when sending a message through the producer would fail on the server side but Interlok had no idea the message had failed. This is because Interloks implementation uses the SQS Asynch method to send messages, which returns a future. The detail of the future was being ignored.
Modification
Asynchronous messaging is not really useful when you need to know the success of a producer before you end the workflow for a single message. Therefore we now simply use the synchronous method to send a message, getting the result back immediately.
First we check for a couple of unchecked exceptions in case something goes completely wrong.
Then with the result we check the HTTP status return code is 200. If it's anything else, we fail.
PR Checklist
Result
What's the end result for the user
Testing
How can I test this if I'm reviewing this.