Skip to content

Commit 5760b84

Browse files
authored
Merge branch 'master' into actor_ttl
2 parents c46c9da + 0fafc97 commit 5760b84

File tree

1,309 files changed

+4253
-3943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,309 files changed

+4253
-3943
lines changed

.github/scripts/create-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if [ "$VARIANT" = "" ]; then
110110
echo "Creating pull request to update docs ..."
111111
branch_name="automation/update_docs_${current_time}"
112112
git reset --hard origin/master
113-
git cherry-pick $RELEASE_TAG
113+
git cherry-pick --strategy=recursive -X theirs $RELEASE_TAG
114114
git push origin $branch_name
115115
gh pr create --repo ${GITHUB_REPOSITORY} \
116116
--base master \

.github/workflows/create-release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ jobs:
5757
runs-on: ubuntu-latest
5858
needs: create-release
5959
steps:
60-
- name: Triggers the build
60+
- name: Identify build ref to trigger build and release.
61+
run: |
62+
if [[ "${{ inputs.rel_version }}" == *"SNAPSHOT"* ]]; then
63+
echo "BUILD_GIT_REF=master" >> $GITHUB_ENV
64+
else
65+
echo "BUILD_GIT_REF=v${{ inputs.rel_version }}" >> $GITHUB_ENV
66+
fi
67+
- name: Triggers the build and release.
6168
env:
6269
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
6370
run: |
64-
gh workflow run build.yml --repo ${GITHUB_REPOSITORY} --ref v$(echo '${{ inputs.rel_version }}' | sed -r 's/^[vV]?([0-9].+)$/\1/')
71+
gh workflow run build.yml --repo ${GITHUB_REPOSITORY} --ref v$(echo '${{ env.BUILD_GIT_REF }}' | sed -r 's/^[vV]?([0-9].+)$/\1/')

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ For a Maven project, add the following to your `pom.xml` file:
4949
<dependency>
5050
<groupId>io.dapr</groupId>
5151
<artifactId>dapr-sdk</artifactId>
52-
<version>1.12.0</version>
52+
<version>1.13.1</version>
5353
</dependency>
5454
<!-- Dapr's SDK for Actors (optional). -->
5555
<dependency>
5656
<groupId>io.dapr</groupId>
5757
<artifactId>dapr-sdk-actors</artifactId>
58-
<version>1.12.0</version>
58+
<version>1.13.1</version>
5959
</dependency>
6060
<!-- Dapr's SDK integration with SpringBoot (optional). -->
6161
<dependency>
6262
<groupId>io.dapr</groupId>
6363
<artifactId>dapr-sdk-springboot</artifactId>
64-
<version>1.12.0</version>
64+
<version>1.13.1</version>
6565
</dependency>
6666
...
6767
</dependencies>
@@ -75,11 +75,11 @@ For a Gradle project, add the following to your `build.gradle` file:
7575
dependencies {
7676
...
7777
// Dapr's core SDK with all features, except Actors.
78-
compile('io.dapr:dapr-sdk:1.12.0')
78+
compile('io.dapr:dapr-sdk:1.13.1')
7979
// Dapr's SDK for Actors (optional).
80-
compile('io.dapr:dapr-sdk-actors:1.12.0')
80+
compile('io.dapr:dapr-sdk-actors:1.13.1')
8181
// Dapr's SDK integration with SpringBoot (optional).
82-
compile('io.dapr:dapr-sdk-springboot:1.12.0')
82+
compile('io.dapr:dapr-sdk-springboot:1.13.1')
8383
}
8484
```
8585

dapr-spring/dapr-spring-boot-autoconfigure/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>dapr-spring-boot-autoconfigure</artifactId>
@@ -27,6 +27,12 @@
2727
<version>${project.parent.version}</version>
2828
<optional>true</optional>
2929
</dependency>
30+
<dependency>
31+
<groupId>io.dapr.spring</groupId>
32+
<artifactId>dapr-spring-workflows</artifactId>
33+
<version>${project.parent.version}</version>
34+
<optional>true</optional>
35+
</dependency>
3036
<dependency>
3137
<groupId>org.springframework.boot</groupId>
3238
<artifactId>spring-boot-starter</artifactId>

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientAutoConfiguration.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
import io.dapr.client.DaprClient;
1717
import io.dapr.client.DaprClientBuilder;
1818
import io.dapr.config.Properties;
19+
import io.dapr.workflows.client.DaprWorkflowClient;
20+
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1921
import org.springframework.boot.autoconfigure.AutoConfiguration;
2022
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2123
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2224
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2325
import org.springframework.context.annotation.Bean;
2426

27+
import java.util.HashMap;
28+
import java.util.Map;
29+
2530
@AutoConfiguration
2631
@ConditionalOnClass(DaprClient.class)
2732
@EnableConfigurationProperties(DaprClientProperties.class)
@@ -58,4 +63,29 @@ DaprClient daprClient(DaprClientBuilder daprClientBuilder) {
5863
return daprClientBuilder.build();
5964
}
6065

66+
@Bean
67+
@ConditionalOnMissingBean
68+
DaprWorkflowClient daprWorkflowClient(DaprConnectionDetails daprConnectionDetails) {
69+
Properties properties = createPropertiesFromConnectionDetails(daprConnectionDetails);
70+
return new DaprWorkflowClient(properties);
71+
}
72+
73+
@Bean
74+
@ConditionalOnMissingBean
75+
WorkflowRuntimeBuilder daprWorkflowRuntimeBuilder(DaprConnectionDetails daprConnectionDetails) {
76+
Properties properties = createPropertiesFromConnectionDetails(daprConnectionDetails);
77+
return new WorkflowRuntimeBuilder(properties);
78+
}
79+
80+
private Properties createPropertiesFromConnectionDetails(DaprConnectionDetails daprConnectionDetails) {
81+
final Map<String, String> propertyOverrides = new HashMap<>();
82+
propertyOverrides.put(Properties.HTTP_ENDPOINT.getName(), daprConnectionDetails.httpEndpoint());
83+
propertyOverrides.put(Properties.HTTP_PORT.getName(), String.valueOf(daprConnectionDetails.httpPort()));
84+
propertyOverrides.put(Properties.GRPC_ENDPOINT.getName(), daprConnectionDetails.grpcEndpoint());
85+
propertyOverrides.put(Properties.GRPC_PORT.getName(), String.valueOf(daprConnectionDetails.grpcPort()));
86+
return new Properties(propertyOverrides);
87+
}
88+
89+
90+
6191
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package io.dapr.spring.boot.autoconfigure.client;
2+
3+
import io.dapr.spring.boot.autoconfigure.client.workflows.TestActivity;
4+
import io.dapr.spring.boot.autoconfigure.client.workflows.TestWorkflow;
5+
import io.dapr.workflows.client.DaprWorkflowClient;
6+
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
7+
import org.junit.jupiter.api.Test;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.boot.test.context.SpringBootTest;
10+
11+
import static org.junit.jupiter.api.Assertions.assertNotNull;
12+
13+
@SpringBootTest(classes = {WorkflowTestApplication.class, DaprClientAutoConfiguration.class, TestActivity.class, TestWorkflow.class})
14+
public class DaprWorkflowsRegistrationTests {
15+
16+
@Autowired
17+
private DaprWorkflowClient daprWorkflowClient;
18+
19+
@Autowired
20+
private WorkflowRuntimeBuilder workflowRuntimeBuilder;
21+
22+
@Autowired
23+
private TestActivity testActivity;
24+
25+
@Autowired
26+
private TestWorkflow testWorkflow;
27+
28+
@Test
29+
public void testWorkflowInjection(){
30+
31+
//I cannot test here if the client works, as it needs the runtime
32+
assertNotNull(daprWorkflowClient);
33+
34+
//@TODO: there is no way to assert the runtime and its registered workflows and activities
35+
assertNotNull(workflowRuntimeBuilder);
36+
37+
//Check that both Activities and Workflows are managed beans
38+
assertNotNull(testActivity);
39+
assertNotNull(testWorkflow);
40+
assertNotNull(testActivity.getRestTemplate());
41+
assertNotNull(testWorkflow.getRestTemplate());
42+
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.dapr.spring.boot.autoconfigure.client;
2+
3+
import io.dapr.spring.workflows.config.EnableDaprWorkflows;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.web.client.RestTemplate;
9+
10+
@SpringBootApplication
11+
@EnableDaprWorkflows
12+
public class WorkflowTestApplication {
13+
public static void main(String[] args) {
14+
SpringApplication.run(WorkflowTestApplication.class, args);
15+
}
16+
17+
@Configuration
18+
static class Config {
19+
@Bean
20+
RestTemplate restTemplate(){
21+
return new RestTemplate();
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.dapr.spring.boot.autoconfigure.client.workflows;
2+
3+
import io.dapr.workflows.WorkflowActivity;
4+
import io.dapr.workflows.WorkflowActivityContext;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.web.client.RestTemplate;
7+
8+
public class TestActivity implements WorkflowActivity {
9+
10+
@Autowired
11+
private RestTemplate restTemplate;
12+
13+
@Override
14+
public Object run(WorkflowActivityContext ctx) {
15+
return "OK";
16+
}
17+
18+
public RestTemplate getRestTemplate() {
19+
return restTemplate;
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.dapr.spring.boot.autoconfigure.client.workflows;
2+
3+
import io.dapr.workflows.Workflow;
4+
import io.dapr.workflows.WorkflowStub;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.web.client.RestTemplate;
7+
8+
public class TestWorkflow implements Workflow {
9+
10+
@Autowired
11+
private RestTemplate restTemplate;
12+
13+
@Override
14+
public WorkflowStub create() {
15+
return ctx -> {
16+
ctx.callActivity(TestActivity.class.getName(), null).await();
17+
};
18+
}
19+
20+
public RestTemplate getRestTemplate() {
21+
return restTemplate;
22+
}
23+
}

dapr-spring/dapr-spring-boot-starters/dapr-spring-boot-starter-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212

0 commit comments

Comments
 (0)