Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

package io.dapr.examples.jobs;

import io.dapr.client.DaprClient;
import io.dapr.client.DaprClientBuilder;
import io.dapr.client.DaprPreviewClient;
import io.dapr.client.domain.GetJobRequest;
import io.dapr.client.domain.GetJobResponse;
import io.dapr.client.domain.JobSchedule;
Expand All @@ -35,7 +35,7 @@ public static void main(String[] args) throws Exception {
Properties.GRPC_PORT, "51439"
);

try (DaprPreviewClient client = new DaprClientBuilder().withPropertyOverrides(overrides).buildPreviewClient()) {
try (DaprClient client = new DaprClientBuilder().withPropertyOverrides(overrides).build()) {

// Schedule a job.
System.out.println("**** Scheduling a Job with name dapr-jobs-1 *****");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class Subscriber {
*/
public static void main(String[] args) throws Exception {
String topicName = getTopicName(args);
try (var client = new DaprClientBuilder().buildPreviewClient()) {
try (var client = new DaprClientBuilder().build()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var subscription = client.subscribeToEvents(
PUBSUB_NAME,
topicName,
Expand Down
48 changes: 48 additions & 0 deletions sdk/src/main/java/io/dapr/client/DaprClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@

import io.dapr.client.domain.ConfigurationItem;
import io.dapr.client.domain.DaprMetadata;
import io.dapr.client.domain.DeleteJobRequest;
import io.dapr.client.domain.DeleteStateRequest;
import io.dapr.client.domain.ExecuteStateTransactionRequest;
import io.dapr.client.domain.GetBulkSecretRequest;
import io.dapr.client.domain.GetBulkStateRequest;
import io.dapr.client.domain.GetConfigurationRequest;
import io.dapr.client.domain.GetJobRequest;
import io.dapr.client.domain.GetJobResponse;
import io.dapr.client.domain.GetSecretRequest;
import io.dapr.client.domain.GetStateRequest;
import io.dapr.client.domain.HttpExtension;
import io.dapr.client.domain.InvokeBindingRequest;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.client.domain.PublishEventRequest;
import io.dapr.client.domain.SaveStateRequest;
import io.dapr.client.domain.ScheduleJobRequest;
import io.dapr.client.domain.State;
import io.dapr.client.domain.StateOptions;
import io.dapr.client.domain.SubscribeConfigurationRequest;
Expand Down Expand Up @@ -702,6 +706,50 @@ Flux<SubscribeConfigurationResponse> subscribeConfiguration(String storeName, Li
*/
Mono<DaprMetadata> getMetadata();

/**
* Subscribe to pubsub via streaming.
* @param pubsubName Name of the pubsub component.
* @param topic Name of the topic to subscribe to.
* @param listener Callback methods to process events.
* @param type Type for object deserialization.
* @return An active subscription.
* @param <T> Type of object deserialization.
*/
<T> Subscription subscribeToEvents(
String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type);

/**
* Schedules a job using the provided job request details.
*
* @param scheduleJobRequest The request containing the details of the job to schedule.
* Must include a name and optional schedule, data, and other related properties.
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);

/**
* Retrieves details of a specific job.
*
* @param getJobRequest The request containing the job name for which the details are to be fetched.
* The name property is mandatory.
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
* error if the job is not found.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/

public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);

/**
* Deletes a job based on the given request.
*
* @param deleteJobRequest The request containing the job name to be deleted.
* The name property is mandatory.
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);

/**
* Gracefully shutdown the dapr runtime.
*
Expand Down
43 changes: 0 additions & 43 deletions sdk/src/main/java/io/dapr/client/DaprPreviewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,49 +265,6 @@ <T> Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicNa
*/
Mono<UnlockResponseStatus> unlock(UnlockRequest request);

/**
* Subscribe to pubsub via streaming.
* @param pubsubName Name of the pubsub component.
* @param topic Name of the topic to subscribe to.
* @param listener Callback methods to process events.
* @param type Type for object deserialization.
* @return An active subscription.
* @param <T> Type of object deserialization.
*/
<T> Subscription subscribeToEvents(
String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type);

/**
* Schedules a job using the provided job request details.
*
* @param scheduleJobRequest The request containing the details of the job to schedule.
* Must include a name and optional schedule, data, and other related properties.
* @return A {@link Mono} that completes when the job scheduling operation is successful or raises an error.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/
public Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest);

/**
* Retrieves details of a specific job.
*
* @param getJobRequest The request containing the job name for which the details are to be fetched.
* The name property is mandatory.
* @return A {@link Mono} that emits the {@link GetJobResponse} containing job details or raises an
* error if the job is not found.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/

public Mono<GetJobResponse> getJob(GetJobRequest getJobRequest);

/**
* Deletes a job based on the given request.
*
* @param deleteJobRequest The request containing the job name to be deleted.
* The name property is mandatory.
* @return A {@link Mono} that completes when the job is successfully deleted or raises an error.
* @throws IllegalArgumentException If the request or its required fields like name are null or empty.
*/
public Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest);

/*
* Converse with an LLM.
Expand Down
Loading
Loading