dapr-client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +22 -5
- data/bin/regen_client.sh +15 -0
- data/dapr.gemspec +1 -1
- data/dapr/proto/common/v1/common.proto +140 -0
- data/dapr/proto/runtime/v1/appcallback.proto +131 -0
- data/dapr/proto/runtime/v1/dapr.proto +155 -0
- data/example.rb +1 -1
- data/examples/app-callback/README.md +20 -0
- data/examples/app-callback/app_callback_example.rb +15 -0
- data/examples/app-callback/app_callback_service.rb +51 -0
- data/examples/invoke-simple/README.md +17 -0
- data/examples/invoke-simple/invoke-caller.rb +19 -0
- data/examples/invoke-simple/invoke-receiver.rb +26 -0
- data/examples/pubsub-simple/README.md +13 -0
- data/examples/pubsub-simple/publisher.rb +15 -0
- data/examples/pubsub-simple/subscriber.rb +28 -0
- data/examples/state-store/README.md +7 -0
- data/examples/state-store/state-store.rb +29 -0
- data/lib/dapr/proto/common/v1/common_pb.rb +87 -0
- data/lib/dapr/proto/runtime/v1/appcallback_pb.rb +62 -0
- data/lib/dapr/proto/runtime/v1/appcallback_services_pb.rb +49 -0
- data/lib/dapr/proto/runtime/v1/dapr_pb.rb +75 -0
- data/lib/dapr/proto/runtime/v1/dapr_services_pb.rb +49 -0
- data/lib/dapr/version.rb +1 -1
- metadata +26 -13
- data/lib/dapr/generated/dapr_pb.rb +0 -99
- data/lib/dapr/generated/dapr_services_pb.rb +0 -29
- data/lib/dapr/generated/daprclient_pb.rb +0 -72
- data/lib/dapr/generated/daprclient_services_pb.rb +0 -27
- data/proto/dapr.proto +0 -108
- data/proto/daprclient.proto +0 -76
data/example.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# AppCallbackExample
|
2
|
+
|
3
|
+
Run the example service:
|
4
|
+
|
5
|
+
```bash
|
6
|
+
dapr run --app-id app-callback --protocol grpc --app-port 50051 \
|
7
|
+
bundle exec ruby app_callback_example.rb
|
8
|
+
```
|
9
|
+
|
10
|
+
Make a request to invoke a method:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
dapr invoke -a app-callback -m foobar -p '{"foo": "bar"}'
|
14
|
+
```
|
15
|
+
|
16
|
+
Publish a message to a topic:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
dapr publish -t "example" -d "5"
|
20
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "./app_callback_service"
|
2
|
+
|
3
|
+
$stdout.sync = true
|
4
|
+
|
5
|
+
port = '0.0.0.0:50051'
|
6
|
+
s = GRPC::RpcServer.new
|
7
|
+
s.add_http2_port(port, :this_port_is_insecure)
|
8
|
+
GRPC.logger.info("... running insecurely on #{port}")
|
9
|
+
service = AppCallbackService
|
10
|
+
s.handle(service)
|
11
|
+
|
12
|
+
# Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to
|
13
|
+
# gracefully shutdown.
|
14
|
+
# User could also choose to run server via call to run_till_terminated
|
15
|
+
s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/proto/runtime/v1/appcallback_services_pb"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
class AppCallbackService < Dapr::Proto::Runtime::V1::AppCallback::Service
|
7
|
+
Any = Google::Protobuf::Any
|
8
|
+
Protocol = Dapr::Proto::Runtime::V1
|
9
|
+
|
10
|
+
def on_invoke(invoke, _call)
|
11
|
+
puts "invoked!"
|
12
|
+
# Be careful! method() is a builtin method in Ruby
|
13
|
+
method = invoke['method']
|
14
|
+
raw_data = invoke.data
|
15
|
+
data = JSON.parse(raw_data.value) if raw_data&.value
|
16
|
+
result = { method: method, data: data }
|
17
|
+
Dapr::Proto::Common::V1::InvokeResponse.new(data: Any.new(value: result.to_json))
|
18
|
+
rescue => ex
|
19
|
+
Dapr::Proto::Common::V1::InvokeResponse.new(data: Any.new(value: { error: ex.inspect }.to_json))
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_topic_subscriptions(_empty, _call)
|
23
|
+
puts "topics requested!"
|
24
|
+
Protocol::ListTopicSubscriptionsResponse.
|
25
|
+
new(subscriptions: Array(Protocol::TopicSubscription.new(topic: "example")))
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_input_bindings(_empty, _call)
|
29
|
+
puts "bindings requested!"
|
30
|
+
Protocol::ListInputBindingsResponse.new(bindings: %w(readers_digest))
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_binding_event(binding_event, _call)
|
34
|
+
puts "binding event!"
|
35
|
+
name = binding_event.name
|
36
|
+
raw_data = binding_event.data
|
37
|
+
metadata = binding_event.metadata
|
38
|
+
puts "Binding Event: name:#{name}, data: #{raw_data}"
|
39
|
+
Protocol::BindingEventResponse.new # data: Any.new(value:)
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_topic_event(topic_event, _call)
|
43
|
+
puts "topic event!"
|
44
|
+
topic = topic_event.topic
|
45
|
+
raw_data = topic_event.data
|
46
|
+
puts "Topic Event: topic:#{topic}, data: #{raw_data}"
|
47
|
+
Google::Protobuf::Empty.new
|
48
|
+
rescue => ex
|
49
|
+
puts ex.inspect
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Example - Invoke
|
2
|
+
|
3
|
+
This example utilizes a receiver and a caller for the OnInvoke / Invoke
|
4
|
+
functionality. It will create a gRPC server and bind the on_invoke method,
|
5
|
+
which gets called after a client sends a direct method invocation.
|
6
|
+
|
7
|
+
## Running
|
8
|
+
|
9
|
+
To run this example, use the following code:
|
10
|
+
|
11
|
+
```
|
12
|
+
# 1. Start Receiver (expose gRPC receiver server on port 50051)
|
13
|
+
dapr run --app-id invoke-receiver --protocol grpc --app-port 50051 bundle exec ruby invoke-receiver.rb
|
14
|
+
|
15
|
+
# 2. Start Caller
|
16
|
+
dapr run --app-id invoke-caller --protocol grpc bundle exec ruby invoke-caller.rb
|
17
|
+
```
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/proto/runtime/v1/dapr_services_pb"
|
4
|
+
|
5
|
+
$stdout.sync = true
|
6
|
+
|
7
|
+
port = ENV["DAPR_GRPC_PORT"]
|
8
|
+
stub = Dapr::Proto::Runtime::V1::Dapr::Stub.new("localhost:#{port}", :this_channel_is_insecure)
|
9
|
+
request = Dapr::Proto::Runtime::V1::InvokeServiceRequest.
|
10
|
+
new(id: "invoke-receiver",
|
11
|
+
message: Dapr::Proto::Common::V1::InvokeRequest.new(
|
12
|
+
method: "my-method",
|
13
|
+
data: Google::Protobuf::Any.new(value: "TEST MESSAGE"),
|
14
|
+
content_type: "text/plain; charset=UTF-8"
|
15
|
+
))
|
16
|
+
response = stub.invoke_service(request)
|
17
|
+
|
18
|
+
puts response.content_type
|
19
|
+
puts response.data.value
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$stdout.sync = true
|
4
|
+
|
5
|
+
require "dapr/proto/runtime/v1/appcallback_services_pb"
|
6
|
+
|
7
|
+
class InvokeReceiverService < Dapr::Proto::Runtime::V1::AppCallback::Service
|
8
|
+
Any = Google::Protobuf::Any
|
9
|
+
|
10
|
+
def on_invoke(invoke, _call)
|
11
|
+
content_type = "text/plain; charset=UTF-8"
|
12
|
+
data = if invoke["method"] == "my-method"
|
13
|
+
Any.new(value: "INVOKE_RECEIVED")
|
14
|
+
else
|
15
|
+
Any.new(value: "unsupported method")
|
16
|
+
end
|
17
|
+
|
18
|
+
Dapr::Proto::Common::V1::InvokeResponse.new(data: data, content_type: content_type)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
server = GRPC::RpcServer.new
|
23
|
+
server.add_http2_port("0.0.0.0:50051", :this_port_is_insecure)
|
24
|
+
server.handle(InvokeReceiverService)
|
25
|
+
|
26
|
+
server.run_till_terminated_or_interrupted([1, +"int", +"SIGQUIT"])
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Example - Pub/Sub
|
2
|
+
|
3
|
+
## Running
|
4
|
+
|
5
|
+
To run this example, use the following commands:
|
6
|
+
|
7
|
+
```bash
|
8
|
+
# 1. Start Subscriber (expose gRPC receiver server on port 50051)
|
9
|
+
dapr run --app-id subscriber --protocol grpc --app-port 50051 bundle exec ruby subscriber.rb
|
10
|
+
|
11
|
+
# 2. Start Publisher
|
12
|
+
dapr run --app-id publisher --protocol grpc bundle exec ruby publisher.rb
|
13
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/proto/runtime/v1/dapr_services_pb"
|
4
|
+
|
5
|
+
$stdout.sync = true
|
6
|
+
|
7
|
+
RuntimeV1 = Dapr::Proto::Runtime::V1
|
8
|
+
|
9
|
+
port = ENV["DAPR_GRPC_PORT"]
|
10
|
+
client = Dapr::Proto::Runtime::V1::Dapr::Stub.new("localhost:#{port}", :this_channel_is_insecure)
|
11
|
+
|
12
|
+
client.publish_event(RuntimeV1::PublishEventRequest.
|
13
|
+
new(topic: "TOPIC_A", data: "ACTION=1"))
|
14
|
+
|
15
|
+
puts "Published!"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/proto/runtime/v1/appcallback_services_pb"
|
4
|
+
|
5
|
+
$stdout.sync = true
|
6
|
+
|
7
|
+
class Subscriber < Dapr::Proto::Runtime::V1::AppCallback::Service
|
8
|
+
RuntimeV1 = Dapr::Proto::Runtime::V1
|
9
|
+
|
10
|
+
# Dapr will call this method to get the list of topics the app
|
11
|
+
# wants to subscribe to. In this example, we are telling Dapr
|
12
|
+
# To subscribe to a topic named TOPIC_A
|
13
|
+
def list_topic_subscriptions(_empty, _call)
|
14
|
+
RuntimeV1::ListTopicSubscriptionsResponse.new(
|
15
|
+
subscriptions: Array(RuntimeV1::TopicSubscription.new(topic: "TOPIC_A")))
|
16
|
+
end
|
17
|
+
|
18
|
+
def on_topic_event(_topic_event, _call)
|
19
|
+
puts "Event received!"
|
20
|
+
Google::Protobuf::Empty.new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
server = GRPC::RpcServer.new
|
25
|
+
server.add_http2_port("0.0.0.0:50051", :this_port_is_insecure)
|
26
|
+
server.handle(Subscriber)
|
27
|
+
|
28
|
+
server.run_till_terminated_or_interrupted([1, +"int", +"SIGQUIT"])
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/proto/runtime/v1/dapr_services_pb"
|
4
|
+
|
5
|
+
$stdout.sync = true
|
6
|
+
|
7
|
+
RuntimeV1 = Dapr::Proto::Runtime::V1
|
8
|
+
|
9
|
+
port = ENV["DAPR_GRPC_PORT"]
|
10
|
+
client = Dapr::Proto::Runtime::V1::Dapr::Stub.new("localhost:#{port}", :this_channel_is_insecure)
|
11
|
+
|
12
|
+
key = "my-key"
|
13
|
+
store_name = "statestore"
|
14
|
+
|
15
|
+
state = Dapr::Proto::Common::V1::StateItem.
|
16
|
+
new(key: key, value: "my state")
|
17
|
+
|
18
|
+
client.save_state(RuntimeV1::SaveStateRequest.
|
19
|
+
new(store_name: store_name, states: Array(state)))
|
20
|
+
puts "Saved!"
|
21
|
+
|
22
|
+
response = client.get_state(RuntimeV1::GetStateRequest.
|
23
|
+
new(store_name: store_name, key: key))
|
24
|
+
puts "Fetched!"
|
25
|
+
puts response.inspect
|
26
|
+
|
27
|
+
client.delete_state(RuntimeV1::DeleteStateRequest.
|
28
|
+
new(store_name: store_name, key: key))
|
29
|
+
puts "Deleted!"
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: dapr/proto/common/v1/common.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/any_pb'
|
7
|
+
require 'google/protobuf/duration_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("dapr/proto/common/v1/common.proto", :syntax => :proto3) do
|
10
|
+
add_message "dapr.proto.common.v1.HTTPExtension" do
|
11
|
+
optional :verb, :enum, 1, "dapr.proto.common.v1.HTTPExtension.Verb"
|
12
|
+
map :querystring, :string, :string, 2
|
13
|
+
end
|
14
|
+
add_enum "dapr.proto.common.v1.HTTPExtension.Verb" do
|
15
|
+
value :NONE, 0
|
16
|
+
value :GET, 1
|
17
|
+
value :HEAD, 2
|
18
|
+
value :POST, 3
|
19
|
+
value :PUT, 4
|
20
|
+
value :DELETE, 5
|
21
|
+
value :CONNECT, 6
|
22
|
+
value :OPTIONS, 7
|
23
|
+
value :TRACE, 8
|
24
|
+
end
|
25
|
+
add_message "dapr.proto.common.v1.InvokeRequest" do
|
26
|
+
optional :method, :string, 1
|
27
|
+
optional :data, :message, 2, "google.protobuf.Any"
|
28
|
+
optional :content_type, :string, 3
|
29
|
+
optional :http_extension, :message, 4, "dapr.proto.common.v1.HTTPExtension"
|
30
|
+
end
|
31
|
+
add_message "dapr.proto.common.v1.InvokeResponse" do
|
32
|
+
optional :data, :message, 1, "google.protobuf.Any"
|
33
|
+
optional :content_type, :string, 2
|
34
|
+
end
|
35
|
+
add_message "dapr.proto.common.v1.StateItem" do
|
36
|
+
optional :key, :string, 1
|
37
|
+
optional :value, :bytes, 2
|
38
|
+
optional :etag, :string, 3
|
39
|
+
map :metadata, :string, :string, 4
|
40
|
+
optional :options, :message, 5, "dapr.proto.common.v1.StateOptions"
|
41
|
+
end
|
42
|
+
add_message "dapr.proto.common.v1.StateOptions" do
|
43
|
+
optional :concurrency, :enum, 1, "dapr.proto.common.v1.StateOptions.StateConcurrency"
|
44
|
+
optional :consistency, :enum, 2, "dapr.proto.common.v1.StateOptions.StateConsistency"
|
45
|
+
optional :retry_policy, :message, 3, "dapr.proto.common.v1.StateRetryPolicy"
|
46
|
+
end
|
47
|
+
add_enum "dapr.proto.common.v1.StateOptions.StateConcurrency" do
|
48
|
+
value :CONCURRENCY_UNSPECIFIED, 0
|
49
|
+
value :CONCURRENCY_FIRST_WRITE, 1
|
50
|
+
value :CONCURRENCY_LAST_WRITE, 2
|
51
|
+
end
|
52
|
+
add_enum "dapr.proto.common.v1.StateOptions.StateConsistency" do
|
53
|
+
value :CONSISTENCY_UNSPECIFIED, 0
|
54
|
+
value :CONSISTENCY_EVENTUAL, 1
|
55
|
+
value :CONSISTENCY_STRONG, 2
|
56
|
+
end
|
57
|
+
add_message "dapr.proto.common.v1.StateRetryPolicy" do
|
58
|
+
optional :threshold, :int32, 1
|
59
|
+
optional :pattern, :enum, 2, "dapr.proto.common.v1.StateRetryPolicy.RetryPattern"
|
60
|
+
optional :interval, :message, 3, "google.protobuf.Duration"
|
61
|
+
end
|
62
|
+
add_enum "dapr.proto.common.v1.StateRetryPolicy.RetryPattern" do
|
63
|
+
value :RETRY_UNSPECIFIED, 0
|
64
|
+
value :RETRY_LINEAR, 1
|
65
|
+
value :RETRY_EXPONENTIAL, 2
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module Dapr
|
71
|
+
module Proto
|
72
|
+
module Common
|
73
|
+
module V1
|
74
|
+
HTTPExtension = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.HTTPExtension").msgclass
|
75
|
+
HTTPExtension::Verb = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.HTTPExtension.Verb").enummodule
|
76
|
+
InvokeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.InvokeRequest").msgclass
|
77
|
+
InvokeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.InvokeResponse").msgclass
|
78
|
+
StateItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateItem").msgclass
|
79
|
+
StateOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateOptions").msgclass
|
80
|
+
StateOptions::StateConcurrency = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateOptions.StateConcurrency").enummodule
|
81
|
+
StateOptions::StateConsistency = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateOptions.StateConsistency").enummodule
|
82
|
+
StateRetryPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateRetryPolicy").msgclass
|
83
|
+
StateRetryPolicy::RetryPattern = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.common.v1.StateRetryPolicy.RetryPattern").enummodule
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: dapr/proto/runtime/v1/appcallback.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/empty_pb'
|
7
|
+
require 'dapr/proto/common/v1/common_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("dapr/proto/runtime/v1/appcallback.proto", :syntax => :proto3) do
|
10
|
+
add_message "dapr.proto.runtime.v1.TopicEventRequest" do
|
11
|
+
optional :id, :string, 1
|
12
|
+
optional :source, :string, 2
|
13
|
+
optional :type, :string, 3
|
14
|
+
optional :spec_version, :string, 4
|
15
|
+
optional :data_content_type, :string, 5
|
16
|
+
optional :data, :bytes, 7
|
17
|
+
optional :topic, :string, 6
|
18
|
+
end
|
19
|
+
add_message "dapr.proto.runtime.v1.BindingEventRequest" do
|
20
|
+
optional :name, :string, 1
|
21
|
+
optional :data, :bytes, 2
|
22
|
+
map :metadata, :string, :string, 3
|
23
|
+
end
|
24
|
+
add_message "dapr.proto.runtime.v1.BindingEventResponse" do
|
25
|
+
optional :store_name, :string, 1
|
26
|
+
repeated :states, :message, 2, "dapr.proto.common.v1.StateItem"
|
27
|
+
repeated :to, :string, 3
|
28
|
+
optional :data, :bytes, 4
|
29
|
+
optional :concurrency, :enum, 5, "dapr.proto.runtime.v1.BindingEventResponse.BindingEventConcurrency"
|
30
|
+
end
|
31
|
+
add_enum "dapr.proto.runtime.v1.BindingEventResponse.BindingEventConcurrency" do
|
32
|
+
value :SEQUENTIAL, 0
|
33
|
+
value :PARALLEL, 1
|
34
|
+
end
|
35
|
+
add_message "dapr.proto.runtime.v1.ListTopicSubscriptionsResponse" do
|
36
|
+
repeated :subscriptions, :message, 1, "dapr.proto.runtime.v1.TopicSubscription"
|
37
|
+
end
|
38
|
+
add_message "dapr.proto.runtime.v1.TopicSubscription" do
|
39
|
+
optional :topic, :string, 1
|
40
|
+
map :metadata, :string, :string, 2
|
41
|
+
end
|
42
|
+
add_message "dapr.proto.runtime.v1.ListInputBindingsResponse" do
|
43
|
+
repeated :bindings, :string, 1
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module Dapr
|
49
|
+
module Proto
|
50
|
+
module Runtime
|
51
|
+
module V1
|
52
|
+
TopicEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.TopicEventRequest").msgclass
|
53
|
+
BindingEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.BindingEventRequest").msgclass
|
54
|
+
BindingEventResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.BindingEventResponse").msgclass
|
55
|
+
BindingEventResponse::BindingEventConcurrency = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.BindingEventResponse.BindingEventConcurrency").enummodule
|
56
|
+
ListTopicSubscriptionsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.ListTopicSubscriptionsResponse").msgclass
|
57
|
+
TopicSubscription = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.TopicSubscription").msgclass
|
58
|
+
ListInputBindingsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.proto.runtime.v1.ListInputBindingsResponse").msgclass
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: dapr/proto/runtime/v1/appcallback.proto for package 'dapr.proto.runtime.v1'
|
3
|
+
# Original file comments:
|
4
|
+
# ------------------------------------------------------------
|
5
|
+
# Copyright (c) Microsoft Corporation.
|
6
|
+
# Licensed under the MIT License.
|
7
|
+
# ------------------------------------------------------------
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'grpc'
|
11
|
+
require 'dapr/proto/runtime/v1/appcallback_pb'
|
12
|
+
|
13
|
+
module Dapr
|
14
|
+
module Proto
|
15
|
+
module Runtime
|
16
|
+
module V1
|
17
|
+
module AppCallback
|
18
|
+
# AppCallback V1 allows user application to interact with Dapr runtime.
|
19
|
+
# User application needs to implement AppCallback service if it needs to
|
20
|
+
# receive message from dapr runtime.
|
21
|
+
class Service
|
22
|
+
|
23
|
+
include GRPC::GenericService
|
24
|
+
|
25
|
+
self.marshal_class_method = :encode
|
26
|
+
self.unmarshal_class_method = :decode
|
27
|
+
self.service_name = 'dapr.proto.runtime.v1.AppCallback'
|
28
|
+
|
29
|
+
# Invokes service method with InvokeRequest.
|
30
|
+
rpc :OnInvoke, Dapr::Proto::Common::V1::InvokeRequest, Dapr::Proto::Common::V1::InvokeResponse
|
31
|
+
# Lists all topics subscribed by this app.
|
32
|
+
rpc :ListTopicSubscriptions, Google::Protobuf::Empty, ListTopicSubscriptionsResponse
|
33
|
+
# Subscribes events from Pubsub
|
34
|
+
rpc :OnTopicEvent, TopicEventRequest, Google::Protobuf::Empty
|
35
|
+
# Lists all input bindings subscribed by this app.
|
36
|
+
rpc :ListInputBindings, Google::Protobuf::Empty, ListInputBindingsResponse
|
37
|
+
# Listens events from the input bindings
|
38
|
+
#
|
39
|
+
# User application can save the states or send the events to the output
|
40
|
+
# bindings optionally by returning BindingEventResponse.
|
41
|
+
rpc :OnBindingEvent, BindingEventRequest, BindingEventResponse
|
42
|
+
end
|
43
|
+
|
44
|
+
Stub = Service.rpc_stub_class
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|