syntax = "proto3"; package GSB_API; /* Exposed by Golem Service Bus API implementation */ service Bus { /* Register a service within the bus */ rpc Register (RegisterRequest) returns (RegisterReply); /* Unregister a service from the bus */ rpc Unregister (UnregisterRequest) returns (UnregisterReply); /* Call a local or remote service method */ rpc ServiceCall (CallRequest) returns (CallReply); /* Subscribe to a broadcast topic */ rpc Subscribe (SubscribeRequest) returns (SubscribeReply); /* Unsubscribe from a broadcast topic */ rpc Unsubscribe (UnsubscribeRequest) returns (UnsubscribeReply); /* Broadcast a message to everyone subscribed to a topic */ rpc Broadcast (BroadcastRequest) returns (BroadcastReply); } /* Exposed by registering services */ service Service { rpc Call (CallRequest) returns (CallReply); rpc Check (Ping) returns (Pong); } message Packet { oneof packet { Hello hello = 1; RegisterRequest register_request = 2; RegisterReply register_reply = 3; UnregisterRequest unregister_request = 4; UnregisterReply unregister_reply = 5; CallRequest call_request = 6; CallReply call_reply = 7; SubscribeRequest subscribe_request = 8; SubscribeReply subscribe_reply = 9; UnsubscribeRequest unsubscribe_request = 10; UnsubscribeReply unsubscribe_reply = 11; BroadcastRequest broadcast_request = 12; BroadcastReply broadcast_reply = 13; Ping ping = 14; Pong pong = 15; } } enum RegisterReplyCode { REGISTERED_OK = 0; REGISTER_BAD_REQUEST = 400; // e.g. invalid name REGISTER_CONFLICT = 409; // already registered } enum UnregisterReplyCode { UNREGISTERED_OK = 0; NOT_REGISTERED = 404; } enum CallReplyCode { CALL_REPLY_OK = 0; CALL_REPLY_BAD_REQUEST = 400; // e.g. duplicate request ID, service not found etc. SERVICE_FAILURE = 500; // e.g. service did not respond in time } enum CallReplyType { FULL = 0; // a single response or end of stream PARTIAL = 1; // i.e. a streaming response } enum SubscribeReplyCode { SUBSCRIBED_OK = 0; SUBSCRIBE_BAD_REQUEST = 400; // e.g. invalid topic name } enum UnsubscribeReplyCode { UNSUBSCRIBED_OK = 0; NOT_SUBSCRIBED = 404; } enum BroadcastReplyCode { BROADCAST_OK = 0; BROADCAST_BAD_REQUEST = 400; // e.g. invalid topic name } message RegisterRequest { string service_id = 1; } message RegisterReply { RegisterReplyCode code = 1; string message = 2; // in case of errors } message UnregisterRequest { string service_id = 1; } message UnregisterReply { UnregisterReplyCode code = 1; } message CallRequest { string caller = 1; string address = 2; string request_id = 3; bytes data = 4; bool no_reply = 5; } message CallReply { string request_id = 1; CallReplyCode code = 2; CallReplyType reply_type = 3; bytes data = 4; } message SubscribeRequest { string topic = 1; } message SubscribeReply { SubscribeReplyCode code = 1; string message = 2; // in case of errors } message UnsubscribeRequest { string topic = 1; } message UnsubscribeReply { UnsubscribeReplyCode code = 1; } message BroadcastRequest { string caller = 1; bytes data = 2; string topic = 3; } message BroadcastReply { BroadcastReplyCode code = 1; string message = 2; // in case of errors } message Ping {} message Pong {} message Hello { string name = 1; string version = 2; bytes instance_id = 3; }