Skip to content

Commit 7bb9bd3

Browse files
committed
promote job and subscribeToEvents out of preview
Signed-off-by: salaboy <Salaboy@gmail.com>
1 parent 1cd6714 commit 7bb9bd3

File tree

6 files changed

+819
-788
lines changed

6 files changed

+819
-788
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
package io.dapr.examples.jobs;
1515

16+
import io.dapr.client.DaprClient;
1617
import io.dapr.client.DaprClientBuilder;
17-
import io.dapr.client.DaprPreviewClient;
1818
import io.dapr.client.domain.GetJobRequest;
1919
import io.dapr.client.domain.GetJobResponse;
2020
import io.dapr.client.domain.JobSchedule;
@@ -35,7 +35,7 @@ public static void main(String[] args) throws Exception {
3535
Properties.GRPC_PORT, "51439"
3636
);
3737

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

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

examples/src/main/java/io/dapr/examples/pubsub/stream/Subscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class Subscriber {
4343
*/
4444
public static void main(String[] args) throws Exception {
4545
String topicName = getTopicName(args);
46-
try (var client = new DaprClientBuilder().buildPreviewClient()) {
46+
try (var client = new DaprClientBuilder().build()) {
4747
var subscription = client.subscribeToEvents(
4848
PUBSUB_NAME,
4949
topicName,

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

Lines changed: 48 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,50 @@ Flux<SubscribeConfigurationResponse> subscribeConfiguration(String storeName, Li
702706
*/
703707
Mono<DaprMetadata> getMetadata();
704708

709+
/**
710+
* Subscribe to pubsub via streaming.
711+
* @param pubsubName Name of the pubsub component.
712+
* @param topic Name of the topic to subscribe to.
713+
* @param listener Callback methods to process events.
714+
* @param type Type for object deserialization.
715+
* @return An active subscription.
716+
* @param <T> Type of object deserialization.
717+
*/
718+
<T> Subscription subscribeToEvents(
719+
String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type);
720+
721+
/**
722+
* Schedules a job using the provided job request details.
723+
*
724+
* @param scheduleJobRequest The request containing the details of the job to schedule.
725+
* Must include a name and optional schedule, data, and other related properties.
726+
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
727+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
728+
*/
729+
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);
730+
731+
/**
732+
* Retrieves details of a specific job.
733+
*
734+
* @param getJobRequest The request containing the job name for which the details are to be fetched.
735+
* The name property is mandatory.
736+
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
737+
* error if the job is not found.
738+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
739+
*/
740+
741+
public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);
742+
743+
/**
744+
* Deletes a job based on the given request.
745+
*
746+
* @param deleteJobRequest The request containing the job name to be deleted.
747+
* The name property is mandatory.
748+
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
749+
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
750+
*/
751+
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);
752+
705753
/**
706754
* Gracefully shutdown the dapr runtime.
707755
*

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -265,49 +265,6 @@ <T> Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicNa
265265
*/
266266
Mono<UnlockResponseStatus> unlock(UnlockRequest request);
267267

268-
/**
269-
* Subscribe to pubsub via streaming.
270-
* @param pubsubName Name of the pubsub component.
271-
* @param topic Name of the topic to subscribe to.
272-
* @param listener Callback methods to process events.
273-
* @param type Type for object deserialization.
274-
* @return An active subscription.
275-
* @param <T> Type of object deserialization.
276-
*/
277-
<T> Subscription subscribeToEvents(
278-
String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type);
279-
280-
/**
281-
* Schedules a job using the provided job request details.
282-
*
283-
* @param scheduleJobRequest The request containing the details of the job to schedule.
284-
* Must include a name and optional schedule, data, and other related properties.
285-
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
286-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
287-
*/
288-
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);
289-
290-
/**
291-
* Retrieves details of a specific job.
292-
*
293-
* @param getJobRequest The request containing the job name for which the details are to be fetched.
294-
* The name property is mandatory.
295-
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
296-
* error if the job is not found.
297-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
298-
*/
299-
300-
public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);
301-
302-
/**
303-
* Deletes a job based on the given request.
304-
*
305-
* @param deleteJobRequest The request containing the job name to be deleted.
306-
* The name property is mandatory.
307-
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
308-
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
309-
*/
310-
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);
311268

312269
/*
313270
* Converse with an LLM.

0 commit comments

Comments
 (0)