The last few weeks I spent looking into Microsoft Azure. I followed along with the fundamental learning paths, but I also focused mostly on the spring boot part. Here are some findings.
Azure Spring Cloud workshop
The Azure Spring Cloud Workshop is a nice overview how to deploy your spring boot application to Azure.
Take-aways
- Something nowhere mentioned is that you get a Eureka Discover compatible server OOTB :) You just need to add the
Eureka Discovery Client
dependency. - The Cloud gateway works great with the discovery service. Without any configurations, it queries the discover service to get a list of services and it creates automatically endpoints for each service. For instance I had a running
todo-service
, with@GetMapping("/todos")
returning all todos. Using the gateway, you get all todos by sending a request to<GATEWAY-URI>/TODO-SERVICE/
- Since the discovery is nowhere to be found in the Azure dashboard - at least I was unable to do so - I added an endpoint in the gateway service
@RestController @RequestMapping("/eureka") public class EurekaController { @Autowired private DiscoveryClient discoveryClient; @GetMapping List<String> services(){ return discoveryClient.getServices(); } }
Toy service - the profanity service
I had an additional day to spend on Azure. I wanted to use the azure content moderation service. I only needed a source to get some questionable content. And then I remembered this twitter account
fuck u
— Developers Swearing (@gitlost) November 8, 2020
And its follow-up tweet
fuck u again
— Developers Swearing (@gitlost) November 8, 2020
So I made these services:
TwitterService
using twitter4j returning the last 20 tweets as StringsModerationSerivce
connecting to the Azure Content Moderation Service returning scores for offensiveness, sexual suggestiveness and sexual explicitnessOffensiveTweetService
pipes the tweets into theModerationService
the original tweet with 3 scores
To make it more visual, I refreshed my jQuery skills and sorted the tweets based on each of the 3 scores.
All in all, it was a fun project to work on. Unfortunately it no longer is available online as my free credit is already used.