syntax = 'proto3'; package gateway_protocol; option java_multiple_files = false; option java_package = "io.zeebe.gateway.protocol"; option go_package = "pb"; message TopologyRequest { } message Partition { int32 partitionId = 1; enum PartitionBrokerRole { LEADER = 0; FOLLOWER = 1; } PartitionBrokerRole role = 3; } message BrokerInfo { int32 nodeId = 1; string host = 2; int32 port = 3; repeated Partition partitions = 4; } message TopologyResponse { repeated BrokerInfo brokers = 1; int32 clusterSize = 2; int32 partitionsCount = 3; int32 replicationFactor = 4; } message WorkflowRequestObject { string name = 1; enum ResourceType { // FILE type means the gateway will try to detect the resource type using the file extension of the name FILE = 0; BPMN = 1; YAML = 2; } ResourceType type = 2; bytes definition = 3; } message DeployWorkflowRequest { repeated WorkflowRequestObject workflows = 1; } message WorkflowMetadata { string bpmnProcessId = 1; int32 version = 2; int64 workflowKey = 3; string resourceName = 4; } message DeployWorkflowResponse { int64 key = 1; repeated WorkflowMetadata workflows = 2; } message PublishMessageRequest { string name = 1; string correlationKey = 2; int64 timeToLive = 3; string messageId = 4; /* payload has to be a valid json object as string */ string payload = 5; } message PublishMessageResponse { } message UpdateJobRetriesRequest { int64 jobKey = 1; int32 retries = 2; } message UpdateJobRetriesResponse { } message FailJobRequest { int64 jobKey = 1; int32 retries = 2; string errorMessage = 3; } message FailJobResponse { } message CompleteJobRequest { int64 jobKey = 1; /* payload has to be a valid json object as string */ string payload = 2; } message CompleteJobResponse { } message CreateWorkflowInstanceRequest { int64 workflowKey = 1; string bpmnProcessId = 2; /* if bpmnProcessId is set version = -1 indicates to use the latest version */ int32 version = 3; /* payload has to be a valid json object as string */ string payload = 4; } message CreateWorkflowInstanceResponse { int64 workflowKey = 1; string bpmnProcessId = 2; int32 version = 3; int64 workflowInstanceKey = 5; } message CancelWorkflowInstanceRequest { int64 workflowInstanceKey = 1; } message CancelWorkflowInstanceResponse { } message UpdateWorkflowInstancePayloadRequest { int64 elementInstanceKey = 1; /* payload has to be a valid json object as string */ string payload = 2; } message UpdateWorkflowInstancePayloadResponse { } message ListWorkflowsRequest { /* optional filter by BPMN process id, if empty all workflows are returned */ string bpmnProcessId = 1; } message ListWorkflowsResponse { repeated WorkflowMetadata workflows = 1; } /* either workflow key or bpmn process id and version has to be specified*/ message GetWorkflowRequest { int64 workflowKey = 1; /* if bpmnProcessId is set version = -1 indicates to use the latest version */ int32 version = 2; string bpmnProcessId = 3; } message GetWorkflowResponse { int64 workflowKey = 1; int32 version = 2; string bpmnProcessId = 3; string resourceName = 4; string bpmnXml = 5; } message ActivateJobsRequest { string type = 1; string worker = 2; int64 timeout = 3; int32 amount = 4; } message JobHeaders { int64 workflowInstanceKey = 1; string bpmnProcessId = 2; int32 workflowDefinitionVersion = 3; int64 workflowKey = 4; string elementId = 5; int64 elementInstanceKey = 6; } message ActivatedJob { int64 key = 1; string type = 2; JobHeaders jobHeaders = 3; // json object as string string customHeaders = 4; string worker = 5; int32 retries = 6; // epoch milliseconds int64 deadline = 7; /* json object as string */ string payload = 8; } message ActivateJobsResponse { repeated ActivatedJob jobs = 1; } message ResolveIncidentRequest { int64 incidentKey = 1; } message ResolveIncidentResponse { } service Gateway { rpc Topology (TopologyRequest) returns (TopologyResponse) { } rpc DeployWorkflow (DeployWorkflowRequest) returns (DeployWorkflowResponse) { } rpc PublishMessage (PublishMessageRequest) returns (PublishMessageResponse) { } rpc UpdateJobRetries (UpdateJobRetriesRequest) returns (UpdateJobRetriesResponse) { } rpc FailJob (FailJobRequest) returns (FailJobResponse) { } rpc CompleteJob (CompleteJobRequest) returns (CompleteJobResponse) { } rpc CreateWorkflowInstance (CreateWorkflowInstanceRequest) returns (CreateWorkflowInstanceResponse) { } rpc CancelWorkflowInstance (CancelWorkflowInstanceRequest) returns (CancelWorkflowInstanceResponse) { } rpc UpdateWorkflowInstancePayload (UpdateWorkflowInstancePayloadRequest) returns (UpdateWorkflowInstancePayloadResponse) { } rpc ActivateJobs (ActivateJobsRequest) returns (stream ActivateJobsResponse) { } rpc ListWorkflows (ListWorkflowsRequest) returns (ListWorkflowsResponse) { } rpc GetWorkflow (GetWorkflowRequest) returns (GetWorkflowResponse) { } rpc ResolveIncident (ResolveIncidentRequest) returns (ResolveIncidentResponse) { } }