Skip to main content

Service Invocation

Service Invocation is a Dapr building block that enables you to call methods on microservices using HTTP or gRPC protocols. Dapr handles service discovery, routing, and secure communication between services.

Key Features

  • Supports HTTP and gRPC protocols
  • Built-in service discovery using Dapr sidecars
  • Secure communication with mutual TLS
  • Automatic retries and error handling

Example Usage

// Call a method on another service using Dapr client
var client = new DaprClientBuilder().Build();
var result = await client.InvokeMethodAsync<string>("order-service", "createOrder", orderData);

Real-World Application

You use Service Invocation to connect microservices in a distributed system. For example, an API gateway can call backend services for order processing, inventory, or billing. Dapr ensures requests are routed securely and reliably.