Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update service invocation examples #3642

Merged
merged 22 commits into from
Aug 24, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,14 @@ namespace EventService
System.Threading.Thread.Sleep(5000);
Random random = new Random();
int orderId = random.Next(1,1000);
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved
using var client = new DaprClientBuilder().Build();

//Using Dapr SDK to invoke a method
var result = client.CreateInvokeMethodRequest(HttpMethod.Get, "checkout", "checkout/" + orderId);
await client.InvokeMethodAsync(result);
var order = new Order("1");
var orderJson = JsonSerializer.Serialize<Order>(order);
var content = new StringContent(orderJson, Encoding.UTF8, "application/json");

var httpClient = DaprClient.CreateInvokeHttpClient();
await httpClient.PostAsJsonAsync($"http://orderprocessor/orders", content);
Console.WriteLine("Order requested: " + orderId);
Console.WriteLine("Result: " + result);
}
Expand Down
Loading