Skip to content

Commit 7cf5f8b

Browse files
authored
Update for proto from dapr runtime version 0.7 (dapr#273)
1 parent cbab5a8 commit 7cf5f8b

File tree

15 files changed

+224
-168
lines changed

15 files changed

+224
-168
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
GOARCH: amd64
2323
GOPROXY: https://proxy.golang.org
2424
JDK_VER: 13.0.x
25-
DAPR_RUNTIME_VER: 0.4.0-rc.1
25+
DAPR_RUNTIME_VER: 0.6.0
2626
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/f84566fb2bf5a599252ab9d6bd82fc78faf94dba/install/install.sh
27-
DAPR_CLI_REF: 60fd705fcd47cd50135162ea70a567234414d7db
28-
DAPR_REF: 643fcda6b7694e0e73b52c59f538598a8b3b3830
27+
DAPR_CLI_REF: 2e607cb6de0bd69770b244020eecd668fcded19b
28+
DAPR_REF: 7d6e111a181d9d3fdd7537e5c7f6c02764064846
2929
OSSRH_USER_TOKEN: ${{ secrets.OSSRH_USER_TOKEN }}
3030
OSSRH_PWD_TOKEN: ${{ secrets.OSSRH_PWD_TOKEN }}
3131
GPG_KEY: ${{ secrets.GPG_KEY }}
@@ -76,6 +76,12 @@ jobs:
7676
make
7777
sudo cp dist/linux_amd64/release/daprd /usr/local/bin/daprd
7878
cd ..
79+
- name: Override placement service.
80+
if: env.DAPR_REF != ''
81+
run: |
82+
docker stop dapr_placement
83+
cd dapr
84+
./dist/linux_amd64/release/placement &
7985
- name: Install Local kafka using docker-compose
8086
run: |
8187
docker-compose -f ./sdk-tests/deploy/local-test-kafka.yml up -d

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ hs_err_pid*
4444
**/components/redis_messagebus.yaml
4545
**/components/statestore.yaml
4646
**/components/messagebus.yaml
47+
**/components/pubsub.yaml
4748
/docs/dapr-sdk-actors
4849
/docs/dapr-sdk-autogen
4950
/docs/dapr-sdk

examples/src/main/java/io/dapr/examples/invoke/grpc/HelloWorldService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
package io.dapr.examples.invoke.grpc;
77

88
import com.google.protobuf.Any;
9-
import io.dapr.DaprClientGrpc;
10-
import io.dapr.DaprClientProtos;
9+
import io.dapr.v1.CommonProtos;
10+
import io.dapr.v1.DaprClientGrpc;
11+
import io.dapr.v1.DaprClientProtos;
1112
import io.grpc.Server;
1213
import io.grpc.ServerBuilder;
1314
import io.grpc.stub.StreamObserver;
@@ -95,13 +96,16 @@ private void awaitTermination() throws InterruptedException {
9596
* @param responseObserver Dapr envelope response.
9697
*/
9798
@Override
98-
public void onInvoke(DaprClientProtos.InvokeEnvelope request, StreamObserver<Any> responseObserver) {
99+
public void onInvoke(CommonProtos.InvokeRequest request,
100+
StreamObserver<CommonProtos.InvokeResponse> responseObserver) {
99101
try {
100102
if ("say".equals(request.getMethod())) {
101103
SayRequest sayRequest =
102104
SayRequest.newBuilder().setMessage(request.getData().getValue().toStringUtf8()).build();
103105
SayResponse sayResponse = this.say(sayRequest);
104-
responseObserver.onNext(Any.pack(sayResponse));
106+
CommonProtos.InvokeResponse.Builder responseBuilder = CommonProtos.InvokeResponse.newBuilder();
107+
responseBuilder.setData(Any.pack(sayResponse));
108+
responseObserver.onNext(responseBuilder.build());
105109
}
106110
} finally {
107111
responseObserver.onCompleted();

examples/src/main/java/io/dapr/examples/invoke/grpc/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ private static class GrpcHelloWorldDaprService extends DaprClientGrpc.DaprClient
5353
SayRequest sayRequest =
5454
SayRequest.newBuilder().setMessage(request.getData().getValue().toStringUtf8()).build();
5555
SayResponse sayResponse = this.say(sayRequest);
56-
responseObserver.onNext(Any.pack(sayResponse));
56+
CommonProtos.InvokeResponse.Builder responseBuilder = CommonProtos.InvokeResponse.newBuilder();
57+
responseBuilder.setData(Any.pack(sayResponse));
58+
responseObserver.onNext(responseBuilder.build());
5759
}
5860
} finally {
5961
responseObserver.onCompleted();

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
<grpc.version>1.25.0</grpc.version>
1818
<protobuf.version>3.11.0</protobuf.version>
1919
<protoc.version>3.10.0</protoc.version>
20-
<dapr.proto.url>https://raw.githubusercontent.com/dapr/dapr/3b792de734594463f6a16ce8c952fe2ed96c0dc0/pkg/proto/dapr/dapr.proto</dapr.proto.url>
21-
<dapr.client.proto.url>https://raw.githubusercontent.com/dapr/dapr/3b792de734594463f6a16ce8c952fe2ed96c0dc0/pkg/proto/daprclient/daprclient.proto</dapr.client.proto.url>
20+
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/89aab21ee86d2f65066bbe530809ee73ac75e921/dapr/proto</dapr.proto.baseurl>
2221
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
2322
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
2423
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>

sdk-autogen/pom.xml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
<artifactId>protoc-jar-maven-plugin</artifactId>
5353
<version>3.10.1</version>
5454
</dependency>
55+
<dependency>
56+
<groupId>io.grpc</groupId>
57+
<artifactId>grpc-stub</artifactId>
58+
<version>1.25.0</version>
59+
</dependency>
5560
</dependencies>
5661

5762
<build>
@@ -61,6 +66,20 @@
6166
<artifactId>download-maven-plugin</artifactId>
6267
<version>1.3.0</version>
6368
<executions>
69+
<execution>
70+
<id>getCommonProto</id>
71+
<!-- the wget goal actually binds itself to this phase by default -->
72+
<phase>initialize</phase>
73+
<goals>
74+
<goal>wget</goal>
75+
</goals>
76+
<configuration>
77+
<url>${dapr.proto.baseurl}/common/v1/common.proto</url>
78+
<outputFileName>common.proto</outputFileName>
79+
<!-- default target location, just to demonstrate the parameter -->
80+
<outputDirectory>${protobuf.input.directory}/dapr/proto/common/v1</outputDirectory>
81+
</configuration>
82+
</execution>
6483
<execution>
6584
<id>getDaprProto</id>
6685
<!-- the wget goal actually binds itself to this phase by default -->
@@ -69,10 +88,10 @@
6988
<goal>wget</goal>
7089
</goals>
7190
<configuration>
72-
<url>${dapr.proto.url}</url>
91+
<url>${dapr.proto.baseurl}/dapr/v1/dapr.proto</url>
7392
<outputFileName>dapr.proto</outputFileName>
7493
<!-- default target location, just to demonstrate the parameter -->
75-
<outputDirectory>${protobuf.input.directory}/dapr</outputDirectory>
94+
<outputDirectory>${protobuf.input.directory}</outputDirectory>
7695
</configuration>
7796
</execution>
7897
<execution>
@@ -83,10 +102,10 @@
83102
<goal>wget</goal>
84103
</goals>
85104
<configuration>
86-
<url>${dapr.client.proto.url}</url>
105+
<url>${dapr.proto.baseurl}/daprclient/v1/daprclient.proto</url>
87106
<outputFileName>daprclient.proto</outputFileName>
88107
<!-- default target location, just to demonstrate the parameter -->
89-
<outputDirectory>${protobuf.input.directory}/daprclient</outputDirectory>
108+
<outputDirectory>${protobuf.input.directory}</outputDirectory>
90109
</configuration>
91110
</execution>
92111
</executions>
@@ -107,8 +126,8 @@
107126
<includeMavenTypes>direct</includeMavenTypes>
108127
<includeStdTypes>true</includeStdTypes>
109128
<inputDirectories>
110-
<include>${protobuf.input.directory}/dapr</include>
111-
<include>${protobuf.input.directory}/daprclient</include>
129+
<include>${protobuf.input.directory}/dapr/proto/common/v1</include>
130+
<include>${protobuf.input.directory}</include>
112131
</inputDirectories>
113132
<outputTargets>
114133
<outputTarget>

sdk-tests/src/test/java/io/dapr/it/DaprRun.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,27 @@ public void start() throws InterruptedException, IOException {
5858
long start = System.currentTimeMillis();
5959
// First, try to stop previous run (if left running).
6060
this.stop();
61-
// Wait for some time in case the previous run did not kill the process on time.
62-
Thread.sleep(10000);
61+
// Wait for the previous run to kill the prior process.
62+
long timeLeft = this.maxWaitMilliseconds - (System.currentTimeMillis() - start);
63+
callWithRetry(() -> {
64+
System.out.println("Checking if previous run for Dapr application has stopped ...");
65+
try {
66+
this.listCommand.run();
67+
throw new RuntimeException("Previous run for app has not stopped yet!");
68+
} catch (IllegalStateException e) {
69+
// Success because we the list command did not find the app id.
70+
} catch (Exception e) {
71+
throw new RuntimeException(e);
72+
}
73+
}, timeLeft);
74+
6375
System.out.println("Starting dapr application ...");
6476
this.startCommand.run();
6577
this.started.set(true);
6678

67-
long timeLeft = this.maxWaitMilliseconds - (System.currentTimeMillis() - start);
79+
timeLeft = this.maxWaitMilliseconds - (System.currentTimeMillis() - start);
6880
callWithRetry(() -> {
69-
System.out.println("Checking if Dapr is listening on HTTP port ...");
81+
System.out.println("Checking if Dapr application has started ...");
7082
try {
7183
this.listCommand.run();
7284
} catch (Exception e) {

sdk-tests/src/test/java/io/dapr/it/binding/http/InputBindingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@SpringBootApplication
1212
public class InputBindingService {
1313

14-
public static final String SUCCESS_MESSAGE = "dapr initialized. Status: Running. Init Elapsed";
14+
public static final String SUCCESS_MESSAGE = "You're up and running!";
1515

1616
public static void main(String[] args) throws Exception {
1717
// If port string is not valid, it will throw an exception.

sdk-tests/src/test/java/io/dapr/it/methodinvoke/http/MethodInvokeService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@SpringBootApplication
1616
public class MethodInvokeService {
1717

18-
public static final String SUCCESS_MESSAGE = "dapr initialized. Status: Running. Init Elapsed";
18+
public static final String SUCCESS_MESSAGE = "You're up and running!";
1919

2020
public static void main(String[] args) {
2121
int port = Integer.parseInt(args[0]);

sdk-tests/src/test/java/io/dapr/it/pubsub/http/SubscriberService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@SpringBootApplication(scanBasePackages = {"io.dapr.springboot", "io.dapr.it.pubsub.http"})
1717
public class SubscriberService {
1818

19-
public static final String SUCCESS_MESSAGE = "dapr initialized. Status: Running. Init Elapsed";
19+
public static final String SUCCESS_MESSAGE = "You're up and running!";
2020

2121
public static void main(String[] args) throws Exception {
2222
int port = Integer.parseInt(args[0]);

0 commit comments

Comments
 (0)