ch05/

directory
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2021 License: CC-BY-4.0

README

Chapter 5: gRPC Beyond the Basics

OrderManagement Service and Client

  • Online retail scenario has a OrderManagement microservice which is responsible for managing the orders and their information. The consumer of that service can add, retrieve, search and update order via that service.

  • OrderManagement service and the consumer of that service are implemented in both Go and Java languages.

  • This sample shows how you can implement both OrderManagement service and its consumer.

Service Definition

package ecommerce;

service OrderManagement {
    rpc addOrder(Order) returns (google.protobuf.StringValue);
    rpc getOrder(google.protobuf.StringValue) returns (Order);
    rpc searchOrders(google.protobuf.StringValue) returns (stream Order);
    rpc updateOrders(stream Order) returns (google.protobuf.StringValue);
    rpc processOrders(stream google.protobuf.StringValue) returns (stream CombinedShipment);
}

message Order {
    string id = 1;
    repeated string items = 2;
    string description = 3;
    float price = 4;
    string destination = 5;
}

message CombinedShipment {
    string id = 1;
    string status = 2;
    repeated Order ordersList = 3;
}

Implementation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL