Skip to content

Commit 5af869f

Browse files
committed
job promotion to DaprClient
Signed-off-by: salaboy <Salaboy@gmail.com>
1 parent a427d64 commit 5af869f

File tree

5 files changed

+685
-683
lines changed

5 files changed

+685
-683
lines changed

examples/src/main/java/io/dapr/examples/jobs/DemoJobsClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.dapr.examples.jobs;
1515

16+
import io.dapr.client.DaprClient;
1617
import io.dapr.client.DaprClientBuilder;
1718
import io.dapr.client.DaprPreviewClient;
1819
import io.dapr.client.domain.GetJobRequest;
@@ -35,7 +36,7 @@ public static void main(String[] args) throws Exception {
3536
Properties.GRPC_PORT, "51439"
3637
);
3738

38-
try (DaprPreviewClient client = new DaprClientBuilder().withPropertyOverrides(overrides).buildPreviewClient()) {
39+
try (DaprClient client = new DaprClientBuilder().withPropertyOverrides(overrides).build()) {
3940

4041
// Schedule a job.
4142
System.out.println("**** Scheduling a Job with name dapr-jobs-1 *****");

sdk/src/main/java/io/dapr/client/DaprClient.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@
1515

1616
import io.dapr.client.domain.ConfigurationItem;
1717
import io.dapr.client.domain.DaprMetadata;
18+
import io.dapr.client.domain.DeleteJobRequest;
1819
import io.dapr.client.domain.DeleteStateRequest;
1920
import io.dapr.client.domain.ExecuteStateTransactionRequest;
2021
import io.dapr.client.domain.GetBulkSecretRequest;
2122
import io.dapr.client.domain.GetBulkStateRequest;
2223
import io.dapr.client.domain.GetConfigurationRequest;
24+
import io.dapr.client.domain.GetJobRequest;
25+
import io.dapr.client.domain.GetJobResponse;
2326
import io.dapr.client.domain.GetSecretRequest;
2427
import io.dapr.client.domain.GetStateRequest;
2528
import io.dapr.client.domain.HttpExtension;
2629
import io.dapr.client.domain.InvokeBindingRequest;
2730
import io.dapr.client.domain.InvokeMethodRequest;
2831
import io.dapr.client.domain.PublishEventRequest;
2932
import io.dapr.client.domain.SaveStateRequest;
33+
import io.dapr.client.domain.ScheduleJobRequest;
3034
import io.dapr.client.domain.State;
3135
import io.dapr.client.domain.StateOptions;
3236
import io.dapr.client.domain.SubscribeConfigurationRequest;
@@ -702,6 +706,38 @@ Flux<SubscribeConfigurationResponse> subscribeConfiguration(String storeName, Li
702706
*/
703707
Mono<DaprMetadata> getMetadata();
704708

709+
/**
710+
* Schedules a job using the provided job request details.
711+
*
712+
* @param scheduleJobRequest The request containing the details of the job to schedule.
713+
* Must include a name and optional schedule, data, and other related properties.
714+
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
715+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
716+
*/
717+
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);
718+
719+
/**
720+
* Retrieves details of a specific job.
721+
*
722+
* @param getJobRequest The request containing the job name for which the details are to be fetched.
723+
* The name property is mandatory.
724+
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
725+
* error if the job is not found.
726+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
727+
*/
728+
729+
public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);
730+
731+
/**
732+
* Deletes a job based on the given request.
733+
*
734+
* @param deleteJobRequest The request containing the job name to be deleted.
735+
* The name property is mandatory.
736+
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
737+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
738+
*/
739+
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);
740+
705741
/**
706742
* Gracefully shutdown the dapr runtime.
707743
*

sdk/src/main/java/io/dapr/client/DaprPreviewClient.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -291,38 +291,6 @@ <T> Subscription subscribeToEvents(
291291
*/
292292
<T> Flux<CloudEvent<T>> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type);
293293

294-
/**
295-
* Schedules a job using the provided job request details.
296-
*
297-
* @param scheduleJobRequest The request containing the details of the job to schedule.
298-
* Must include a name and optional schedule, data, and other related properties.
299-
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
300-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
301-
*/
302-
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);
303-
304-
/**
305-
* Retrieves details of a specific job.
306-
*
307-
* @param getJobRequest The request containing the job name for which the details are to be fetched.
308-
* The name property is mandatory.
309-
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
310-
* error if the job is not found.
311-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
312-
*/
313-
314-
public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);
315-
316-
/**
317-
* Deletes a job based on the given request.
318-
*
319-
* @param deleteJobRequest The request containing the job name to be deleted.
320-
* The name property is mandatory.
321-
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
322-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
323-
*/
324-
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);
325-
326294
/*
327295
* Converse with an LLM.
328296
*

0 commit comments

Comments
 (0)