Skip to content

Instantly share code, notes, and snippets.

@GooRiOn
Last active June 16, 2021 05:27
Show Gist options
  • Save GooRiOn/55e91121b8c6ed7a8d4c63a3fe7787dd to your computer and use it in GitHub Desktop.
Save GooRiOn/55e91121b8c6ed7a8d4c63a3fe7787dd to your computer and use it in GitHub Desktop.

Synchronous communication between services pt.1

Change the implementation of command handler SendStoryHandler inside stories-service so it now fetches the user from users-service. Make the usage of IHttpClient from Convey package. The following steps will guide you through the process:

  1. Register HTTP client using AddHttpClient() method in Extensions.cs (infrastructure-layer)
  2. Change the implementation of UsersApiHttpClient so it now uses IHttpClient injected into the ctor. Either hardcode the URL or make usage of HttpClientOptions.
  3. Change implementation of command handler so it now uses the API Client.
  4. Test the flow! Remember to have users-service ruuning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment