-
-
Save dcomartin/d258a0b6ace703651b0e435d956efb3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExternalOrderIntegration | |
{ | |
private readonly IMessageSession _messageSession; | |
private readonly HttpClient _httpClient; | |
public ExternalOrderIntegration(IMessageSession messageSession, HttpClient httpClient) | |
{ | |
_messageSession = messageSession; | |
_httpClient = httpClient; | |
} | |
public async Task PlaceOrder() | |
{ | |
var response = await _httpClient.GetAsync("http://external.com/newOrders"); | |
var externalOrder = await response.Deserialize<ExternalOrder>(); | |
var placeOrder = new PlaceOrder | |
{ | |
OrderId = externalOrder!.Id, | |
// Translation to convert an external order or PlaceOrder command | |
}; | |
await _messageSession.Send(placeOrder); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment