getLogDates(){
34 | return logDates;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/durabletask-client/src/main/java/io/dapr/durabletask/TaskCanceledException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.durabletask;
15 |
16 | //@TODO: This should inherit from Exception, not TaskFailedException
17 |
18 | /**
19 | * Represents a task cancellation, either because of a timeout or because of an explicit cancellation operation.
20 | */
21 | public final class TaskCanceledException extends TaskFailedException {
22 | // Only intended to be created within this package
23 | TaskCanceledException(String message, String taskName, int taskId) {
24 | super(message, taskName, taskId, new FailureDetails(TaskCanceledException.class.getName(), message, "", true));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/examples/src/main/java/io/dapr/examples/jobs/DemoJobsSpringApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.examples.jobs;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 | /**
20 | * Spring Boot application to demonstrate Dapr Jobs callback API.
21 | *
22 | * This application demonstrates how to use Dapr Jobs API with Spring Boot.
23 | *
24 | */
25 | @SpringBootApplication
26 | public class DemoJobsSpringApplication {
27 |
28 | public static void main(String[] args) throws Exception {
29 | SpringApplication.run(DemoJobsSpringApplication.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/dapr-spring/dapr-spring-data/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | io.dapr.spring
8 | dapr-spring-parent
9 | 1.17.0-SNAPSHOT
10 | ../pom.xml
11 |
12 |
13 | dapr-spring-data
14 | dapr-spring-data
15 | Dapr Spring Data
16 | jar
17 |
18 |
19 |
20 | org.springframework.data
21 | spring-data-keyvalue
22 |
23 |
24 | io.dapr
25 | dapr-sdk
26 |
27 |
28 |
29 |
30 |
31 |
32 | org.sonatype.plugins
33 | nexus-staging-maven-plugin
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/package-search-index.js:
--------------------------------------------------------------------------------
1 | packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"io.dapr"},{"l":"io.dapr.actors"},{"l":"io.dapr.actors.client"},{"l":"io.dapr.actors.runtime"},{"l":"io.dapr.client"},{"l":"io.dapr.client.domain"},{"l":"io.dapr.client.domain.query"},{"l":"io.dapr.client.domain.query.filters"},{"l":"io.dapr.client.resiliency"},{"l":"io.dapr.config"},{"l":"io.dapr.exceptions"},{"l":"io.dapr.internal.exceptions"},{"l":"io.dapr.internal.grpc"},{"l":"io.dapr.internal.grpc.interceptors"},{"l":"io.dapr.internal.opencensus"},{"l":"io.dapr.internal.resiliency"},{"l":"io.dapr.serializer"},{"l":"io.dapr.spring.boot.autoconfigure.client"},{"l":"io.dapr.spring.boot.autoconfigure.pubsub"},{"l":"io.dapr.spring.boot.autoconfigure.statestore"},{"l":"io.dapr.spring.boot.testcontainers.service.connection"},{"l":"io.dapr.spring.data"},{"l":"io.dapr.spring.data.repository.config"},{"l":"io.dapr.spring.data.repository.query"},{"l":"io.dapr.spring.messaging"},{"l":"io.dapr.spring.messaging.observation"},{"l":"io.dapr.spring.workflows.config"},{"l":"io.dapr.testcontainers"},{"l":"io.dapr.testcontainers.converter"},{"l":"io.dapr.utils"},{"l":"io.dapr.v1"},{"l":"io.dapr.workflows"},{"l":"io.dapr.workflows.client"},{"l":"io.dapr.workflows.internal"},{"l":"io.dapr.workflows.runtime"}];updateSearchResults();
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/methodinvoke/http/Person.java:
--------------------------------------------------------------------------------
1 | package io.dapr.it.methodinvoke.http;
2 |
3 | import java.util.Date;
4 |
5 | public class Person {
6 |
7 | private int id;
8 | private String name;
9 | private String lastName;
10 | private Date birthDate;
11 |
12 | @Override
13 | public String toString() {
14 | return "Person{" +
15 | "id=" + id +
16 | ", name='" + name + '\'' +
17 | ", lastName='" + lastName + '\'' +
18 | ", birthDate=" + birthDate +
19 | '}';
20 | }
21 |
22 | public int getId() {
23 | return id;
24 | }
25 |
26 | public void setId(int id) {
27 | this.id = id;
28 | }
29 |
30 | public String getName() {
31 | return name;
32 | }
33 |
34 | public void setName(String name) {
35 | this.name = name;
36 | }
37 |
38 | public String getLastName() {
39 | return lastName;
40 | }
41 |
42 | public void setLastName(String lastName) {
43 | this.lastName = lastName;
44 | }
45 |
46 | public Date getBirthDate() {
47 | return birthDate;
48 | }
49 |
50 | public void setBirthDate(Date birthDate) {
51 | this.birthDate = birthDate;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/dapr-spring/dapr-spring-messaging/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | io.dapr.spring
8 | dapr-spring-parent
9 | 1.17.0-SNAPSHOT
10 | ../pom.xml
11 |
12 |
13 | dapr-spring-messaging
14 | dapr-spring-messaging
15 | Dapr Spring Messaging
16 | jar
17 |
18 |
19 |
20 | org.springframework
21 | spring-context
22 |
23 |
24 | io.dapr
25 | dapr-sdk
26 |
27 |
28 |
29 |
30 |
31 |
32 | org.sonatype.plugins
33 | nexus-staging-maven-plugin
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/sdk/src/test/java/io/dapr/client/DaprClientTestBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.client;
15 |
16 | import io.dapr.serializer.DefaultObjectSerializer;
17 |
18 | /**
19 | * Builder for DaprClient used in tests only.
20 | */
21 | public class DaprClientTestBuilder {
22 |
23 | /**
24 | * Builds a DaprClient only for HTTP calls.
25 | * @param client DaprHttp used for http calls (can be mocked or stubbed)
26 | * @return New instance of DaprClient.
27 | */
28 | public static DaprClient buildClientForHttpOnly(DaprHttp client) {
29 | return new DaprClientImpl(null, null, client, new DefaultObjectSerializer(), new DefaultObjectSerializer());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-boot-examples/workflows/multi-app/worker-one/src/test/java/io/dapr/springboot/examples/workerone/TestWorkerOneApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot.examples.workerone;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 |
20 | @SpringBootApplication
21 | public class TestWorkerOneApplication {
22 |
23 | public static void main(String[] args) {
24 |
25 | SpringApplication.from(WorkerOneApplication::main)
26 | .with(DaprTestContainersConfig.class)
27 | .run(args);
28 | org.testcontainers.Testcontainers.exposeHostPorts(8081);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/spring-boot-examples/workflows/multi-app/worker-two/src/test/java/io/dapr/springboot/examples/workertwo/TestWorkerTwoApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot.examples.workertwo;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 |
20 | @SpringBootApplication
21 | public class TestWorkerTwoApplication {
22 |
23 | public static void main(String[] args) {
24 |
25 | SpringApplication.from(WorkerTwoApplication::main)
26 | .with(DaprTestContainersConfig.class)
27 | .run(args);
28 | org.testcontainers.Testcontainers.exposeHostPorts(8082);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/spring-boot-examples/workflows/patterns/src/test/java/io/dapr/springboot/examples/wfp/TestWorkflowPatternsApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot.examples.wfp;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 |
20 | @SpringBootApplication
21 | public class TestWorkflowPatternsApplication {
22 |
23 | public static void main(String[] args) {
24 |
25 | SpringApplication.from(WorkflowPatternsApplication::main)
26 | .with(DaprTestContainersConfig.class)
27 | .run(args);
28 | org.testcontainers.Testcontainers.exposeHostPorts(8080);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.actors.runtime;
15 |
16 | import io.dapr.actors.ActorId;
17 |
18 | /**
19 | * Creates an actor of a given type.
20 | *
21 | * @param Actor Type to be created.
22 | */
23 | @FunctionalInterface
24 | public interface ActorFactory {
25 |
26 | /**
27 | * Creates an Actor.
28 | *
29 | * @param actorRuntimeContext Actor type's context in the runtime.
30 | * @param actorId Actor Id.
31 | * @return Actor or null it failed.
32 | */
33 | T createActor(ActorRuntimeContext actorRuntimeContext, ActorId actorId);
34 | }
35 |
--------------------------------------------------------------------------------
/spring-boot-examples/workflows/multi-app/orchestrator/src/test/java/io/dapr/springboot/examples/orchestrator/TestOrchestratorApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot.examples.orchestrator;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 |
20 | @SpringBootApplication
21 | public class TestOrchestratorApplication {
22 |
23 | public static void main(String[] args) {
24 |
25 | SpringApplication.from(OrchestratorApplication::main)
26 | .with(DaprTestContainersConfig.class)
27 | .run(args);
28 | org.testcontainers.Testcontainers.exposeHostPorts(8080);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/actors/app/MyObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.it.actors.app;
15 |
16 | /**
17 | * This class is for passing string or binary data to the Actor for registering reminder later on during test.
18 | */
19 | public class MyObject {
20 |
21 | private String name;
22 |
23 | private int age;
24 |
25 | public String getName() {
26 | return name;
27 | }
28 |
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 |
33 | public int getAge() {
34 | return age;
35 | }
36 |
37 | public void setAge(int age) {
38 | this.age = age;
39 | }
40 |
41 | public String toString() {
42 | return this.name + "," + this.age;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/client/domain/ActorMetadata.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.client.domain;
15 |
16 | /**
17 | * ActorMetadata describes a registered Dapr Actor.
18 | */
19 | public final class ActorMetadata {
20 | private final String type;
21 | private final int count;
22 |
23 | /**
24 | * Constructor for a ActorMetadata.
25 | *
26 | * @param type of the actor
27 | * @param count number of actors of a particular type
28 | */
29 | public ActorMetadata(String type, int count) {
30 | this.type = type;
31 | this.count = count;
32 | }
33 |
34 | public String getType() {
35 | return type;
36 | }
37 |
38 | public int getCount() {
39 | return count;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/testcontainers-dapr/src/main/java/io/dapr/testcontainers/AppHttpPipeline.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.testcontainers;
15 |
16 | import java.util.Collections;
17 | import java.util.List;
18 |
19 | public class AppHttpPipeline implements ConfigurationSettings {
20 | private List handlers;
21 |
22 | /**
23 | * Creates an AppHttpPipeline.
24 | *
25 | * @param handlers List of handlers for the AppHttpPipeline
26 | */
27 | public AppHttpPipeline(List handlers) {
28 | if (handlers != null) {
29 | this.handlers = Collections.unmodifiableList(handlers);
30 | }
31 | }
32 |
33 | public List getHandlers() {
34 | return handlers;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/sdk-springboot/src/main/java/io/dapr/springboot/DaprTopicRoutes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot;
15 |
16 | import com.fasterxml.jackson.annotation.JsonProperty;
17 |
18 | import java.util.List;
19 | import java.util.Optional;
20 |
21 | class DaprTopicRoutes {
22 | private final List rules;
23 | @JsonProperty("default")
24 | private final String defaultRoute;
25 |
26 | DaprTopicRoutes(List rules, String defaultRoute) {
27 | this.rules = rules;
28 | this.defaultRoute = defaultRoute;
29 | }
30 |
31 | public List getRules() {
32 | return rules;
33 | }
34 |
35 | public String getDefaultRoute() {
36 | return defaultRoute;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/config/SecondsDurationProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.config;
15 |
16 | import java.time.Duration;
17 |
18 | /**
19 | * Integer configuration property.
20 | */
21 | public class SecondsDurationProperty extends Property {
22 |
23 | /**
24 | * {@inheritDoc}
25 | */
26 | SecondsDurationProperty(String name, String envName, Duration defaultValue) {
27 | super(name, envName, defaultValue);
28 | }
29 |
30 | /**
31 | * {@inheritDoc}
32 | */
33 | @Override
34 | protected Duration parse(String value) {
35 | long longValue = Long.parseLong(value);
36 | return Duration.ofSeconds(longValue);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/examples/src/main/java/io/dapr/examples/actors/DemoActor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.examples.actors;
15 |
16 | import io.dapr.actors.ActorMethod;
17 | import io.dapr.actors.ActorType;
18 | import reactor.core.publisher.Mono;
19 |
20 | /**
21 | * Example of implementation of an Actor.
22 | */
23 | @ActorType(name = "DemoActor")
24 | public interface DemoActor {
25 |
26 | void registerTimer(String state);
27 |
28 | void registerReminder(int index);
29 |
30 | @ActorMethod(name = "echo_message")
31 | String say(String something);
32 |
33 | void clock(String message);
34 |
35 | @ActorMethod(returns = Integer.class)
36 | Mono incrementAndGet(int delta);
37 | }
38 |
--------------------------------------------------------------------------------
/sdk-workflows/src/main/java/io/dapr/workflows/Workflow.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.workflows;
15 |
16 | /**
17 | * Common interface for workflow implementations.
18 | */
19 | public interface Workflow {
20 | /**
21 | * Executes the workflow logic.
22 | *
23 | * @return A WorkflowStub.
24 | */
25 | WorkflowStub create();
26 |
27 | /**
28 | * Executes the workflow logic.
29 | *
30 | * @param ctx provides access to methods for scheduling durable tasks and
31 | * getting information about the current
32 | * workflow instance.
33 | */
34 | default void run(WorkflowContext ctx) {
35 | WorkflowStub stub = this.create();
36 |
37 | stub.run(ctx);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/serializer/CustomizableObjectSerializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.serializer;
15 |
16 | import com.fasterxml.jackson.databind.ObjectMapper;
17 | import io.dapr.client.ObjectSerializer;
18 |
19 | public class CustomizableObjectSerializer extends ObjectSerializer implements DaprObjectSerializer {
20 |
21 | private final ObjectMapper objectMapper;
22 |
23 | public CustomizableObjectSerializer(ObjectMapper objectMapper) {
24 | this.objectMapper = objectMapper;
25 | }
26 |
27 | @Override
28 | public ObjectMapper getObjectMapper() {
29 | return objectMapper;
30 | }
31 |
32 | @Override
33 | public String getContentType() {
34 | return "application/json";
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/client/domain/ConversationTools.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.client.domain;
15 |
16 | /**
17 | * Represents tool definitions that can be used during conversation.
18 | */
19 | public class ConversationTools {
20 |
21 | private final ConversationToolsFunction function;
22 |
23 | /**
24 | * Constructor.
25 | *
26 | * @param function the function definition
27 | */
28 | public ConversationTools(ConversationToolsFunction function) {
29 | this.function = function;
30 | }
31 |
32 | /**
33 | * Gets the function definition.
34 | *
35 | * @return the function definition
36 | */
37 | public ConversationToolsFunction getFunction() {
38 | return function;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/config/MillisecondsDurationProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.config;
15 |
16 | import java.time.Duration;
17 |
18 | /**
19 | * Integer configuration property.
20 | */
21 | public class MillisecondsDurationProperty extends Property {
22 |
23 | /**
24 | * {@inheritDoc}
25 | */
26 | MillisecondsDurationProperty(String name, String envName, Duration defaultValue) {
27 | super(name, envName, defaultValue);
28 | }
29 |
30 | /**
31 | * {@inheritDoc}
32 | */
33 | @Override
34 | protected Duration parse(String value) {
35 | long longValue = Long.parseLong(value);
36 | return Duration.ofMillis(longValue);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/test/java/io/dapr/runtime/TopicListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.runtime;
15 |
16 | import io.dapr.client.domain.CloudEvent;
17 | import reactor.core.publisher.Mono;
18 |
19 | import java.util.Map;
20 |
21 | /**
22 | * Processes a given topic's message delivery.
23 | */
24 | public interface TopicListener {
25 |
26 | /**
27 | * Processes a given topic's message delivery.
28 | * @param message Message event to be processed.
29 | * @param metadata Headers (or metadata).
30 | * @return Empty response.
31 | * @throws Exception Any exception from user code.
32 | */
33 | Mono process(CloudEvent message, Map metadata) throws Exception;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/DaprApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.it.actors.services.springboot;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 |
19 | /**
20 | * Dapr's HTTP callback implementation via SpringBoot.
21 | */
22 | @SpringBootApplication
23 | public class DaprApplication {
24 |
25 | /**
26 | * Starts Dapr's callback in a given port.
27 | *
28 | * @param port Port to listen to.
29 | */
30 | public static void start(long port) {
31 | SpringApplication app = new SpringApplication(DaprApplication.class);
32 | app.run(String.format("--server.port=%d", port));
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/sdk-actors/src/main/java/io/dapr/actors/client/DaprClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.actors.client;
15 |
16 | import reactor.core.publisher.Mono;
17 |
18 | /**
19 | * Generic Client Adapter to be used regardless of the GRPC or the HTTP Client implementation required.
20 | */
21 | interface DaprClient {
22 |
23 | /**
24 | * Invokes an Actor method on Dapr.
25 | *
26 | * @param actorType Type of actor.
27 | * @param actorId Actor Identifier.
28 | * @param methodName Method name to invoke.
29 | * @param jsonPayload Serialized body.
30 | * @return Asynchronous result with the Actor's response.
31 | */
32 | Mono invoke(String actorType, String actorId, String methodName, byte[] jsonPayload);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/client/domain/RuleMetadata.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.client.domain;
15 |
16 | /**
17 | * RuleMetadata describes the Subscription Rule's Metadata.
18 | */
19 | public final class RuleMetadata {
20 |
21 | private final String match;
22 | private final String path;
23 |
24 | /**
25 | * Constructor for a RuleMetadata.
26 | *
27 | * @param match CEL expression to match the message
28 | * @param path path to route the message
29 | */
30 | public RuleMetadata(String match, String path) {
31 | this.match = match;
32 | this.path = path;
33 | }
34 |
35 | public String getMatch() {
36 | return match;
37 | }
38 |
39 | public String getPath() {
40 | return path;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/config/GenericProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.config;
15 |
16 | import java.util.function.Function;
17 |
18 | /**
19 | * Configuration property for any type.
20 | */
21 | public class GenericProperty extends Property {
22 |
23 | private final Function parser;
24 |
25 | /**
26 | * {@inheritDoc}
27 | */
28 | GenericProperty(String name, String envName, T defaultValue, Function parser) {
29 | super(name, envName, defaultValue);
30 | this.parser = parser;
31 | }
32 |
33 | /**
34 | * {@inheritDoc}
35 | */
36 | @Override
37 | protected T parse(String value) {
38 | return parser.apply(value);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/examples/src/main/java/io/dapr/examples/OpenTelemetryInterceptorConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.examples;
15 |
16 | import org.springframework.beans.factory.annotation.Autowired;
17 | import org.springframework.stereotype.Component;
18 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
19 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
20 |
21 | @Component
22 | public class OpenTelemetryInterceptorConfig extends WebMvcConfigurationSupport {
23 |
24 | @Autowired
25 | OpenTelemetryInterceptor interceptor;
26 |
27 | @Override
28 | public void addInterceptors(InterceptorRegistry registry) {
29 | registry.addInterceptor(interceptor);
30 | }
31 | }
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/Retry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.it;
15 |
16 | public class Retry {
17 |
18 | private Retry() {}
19 |
20 | public static void callWithRetry(Runnable function, long retryTimeoutMilliseconds) throws InterruptedException {
21 | long started = System.currentTimeMillis();
22 | while (true) {
23 | Throwable exception;
24 | try {
25 | function.run();
26 | return;
27 | } catch (Exception e) {
28 | exception = e;
29 | } catch (AssertionError e) {
30 | exception = e;
31 | }
32 |
33 | if (System.currentTimeMillis() - started >= retryTimeoutMilliseconds) {
34 | throw new RuntimeException(exception);
35 | }
36 | Thread.sleep(1000);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptorConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.it.tracing.http;
15 |
16 | import org.springframework.beans.factory.annotation.Autowired;
17 | import org.springframework.stereotype.Component;
18 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
19 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
20 |
21 | @Component
22 | public class OpenTelemetryInterceptorConfig extends WebMvcConfigurationSupport {
23 |
24 | @Autowired
25 | OpenTelemetryInterceptor interceptor;
26 |
27 | @Override
28 | public void addInterceptors(InterceptorRegistry registry) {
29 | registry.addInterceptor(interceptor);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/sdk/src/main/java/io/dapr/client/resiliency/ResiliencyOptions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.client.resiliency;
15 |
16 | import java.time.Duration;
17 |
18 | /**
19 | * Resiliency policy for SDK communication to Dapr API.
20 | */
21 | public final class ResiliencyOptions {
22 |
23 | private Duration timeout;
24 |
25 | private Integer maxRetries;
26 |
27 | public Duration getTimeout() {
28 | return timeout;
29 | }
30 |
31 | public ResiliencyOptions setTimeout(Duration timeout) {
32 | this.timeout = timeout;
33 | return this;
34 | }
35 |
36 | public Integer getMaxRetries() {
37 | return maxRetries;
38 | }
39 |
40 | public ResiliencyOptions setMaxRetries(Integer maxRetries) {
41 | this.maxRetries = maxRetries;
42 | return this;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-boot-examples/producer-app/src/main/java/io/dapr/springboot/examples/producer/CustomerStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.springboot.examples.producer;
15 |
16 | import org.springframework.stereotype.Component;
17 |
18 | import java.util.Collection;
19 | import java.util.HashMap;
20 | import java.util.Map;
21 |
22 | @Component
23 | public class CustomerStore {
24 | private Map customers = new HashMap<>();
25 |
26 | public void addCustomer(Customer customer) {
27 | customers.put(customer.getCustomerName(), customer);
28 | }
29 |
30 | public Customer getCustomer(String customerName) {
31 | return customers.get(customerName);
32 | }
33 |
34 | public Collection getCustomers() {
35 | return customers.values();
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/sdk-tests/src/test/java/io/dapr/it/testcontainers/actors/TestActorsApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 The Dapr Authors
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 |
14 | package io.dapr.it.testcontainers.actors;
15 |
16 | import org.springframework.boot.SpringApplication;
17 | import org.springframework.boot.autoconfigure.SpringBootApplication;
18 | import org.springframework.web.bind.annotation.GetMapping;
19 | import org.springframework.web.bind.annotation.RestController;
20 |
21 | @SpringBootApplication
22 | @RestController
23 | public class TestActorsApplication {
24 |
25 | public static void main(String[] args) {
26 | SpringApplication.run(TestActorsApplication.class, args);
27 | }
28 |
29 | //Mocking the actuator health endpoint for the sidecar health check
30 | @GetMapping("/actuator/health")
31 | public String health(){
32 | return "OK";
33 | }
34 | }
35 |
--------------------------------------------------------------------------------