A gRPC endpoint gives a client a way to call a service operation. In an Order service, exposing Create takes more than starting a server: the server must listen on a TCP port, register the Order service, and provide a handler that connects the request to application logic. section 4.2.6
Keep the network boundary separate from the application:
- Register the gRPC adapter with the server. Enable reflection in development to test calls with grpcurl; otherwise, supply grpcurl with the relevant .proto files. section 4.2.6
- In Create, convert CreateOrderRequest items into domain order items, call APIPort.PlaceOrder, and return the resulting order ID or error. section 4.2.6
- For an outbound call, configure the Payment service endpoint separately. The Order service reads PAYMENT_SERVICE_URL, fails startup if it is missing, and uses it to initialize the payment adapter. section 5.2.5
func (a Adapter) Create(ctx context.Context, request *order.CreateOrderRequest) (*order.CreateOrderResponse, error) { #1
var orderItems []domain.OrderItem
for _, orderItem := range request.OrderItems { #2
orderItems = append(orderItems, domain.OrderItem{
ProductCode: orderItem.ProductCode,
UnitPrice: orderItem.UnitPrice,
Quantity: orderItem.Quantity,
})
}
newOrder := domain.NewOrder(request.UserId, orderItems) #3
result, err := a.api.PlaceOrder(newOrder) #4
if err != nil {
return nil, err
}
return &order.CreateOrderResponse{OrderId: result.ID}, nil
}
The Create handler shows where the network request becomes a domain order and where application errors return to the gRPC caller. section 4.2.6
Endpoint access also has operational consequences. Public APIs need clear names for consumers and may need authentication, authorization, and rate limiting to protect server resources. Other endpoint URLs serve different purposes: tests obtain a running MySQL container’s connection URL, while an OpenTelemetry Collector endpoint accepts metrics from gRPC microservices. These are addresses to connect to, not additional Order service methods. section 1.4.5 section 7.3.2 section 9.3.2

























