Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2021 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.client;
import io.dapr.client.domain.ConfigurationItem;
import io.dapr.client.domain.DaprMetadata;
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.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.State;
import io.dapr.client.domain.StateOptions;
import io.dapr.client.domain.SubscribeConfigurationRequest;
import io.dapr.client.domain.SubscribeConfigurationResponse;
import io.dapr.client.domain.TransactionalStateOperation;
import io.dapr.client.domain.UnsubscribeConfigurationRequest;
import io.dapr.client.domain.UnsubscribeConfigurationResponse;
import io.dapr.utils.TypeRef;
import io.grpc.Channel;
import io.grpc.stub.AbstractStub;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* Generic Client Adapter to be used regardless of the GRPC or the HTTP Client implementation required.
*
* @see io.dapr.client.DaprClientBuilder for information on how to make instance for this interface.
*/
public interface DaprClient extends AutoCloseable {
/**
* Waits for the sidecar, giving up after timeout.
* @param timeoutInMilliseconds Timeout in milliseconds to wait for sidecar.
* @return a Mono plan of type Void.
*/
Mono waitForSidecar(int timeoutInMilliseconds);
/**
* Publish an event.
*
* @param pubsubName the pubsub name we will publish the event to
* @param topicName the topicName where the event will be published.
* @param data the event's data to be published, use byte[] for skipping serialization.
* @return a Mono plan of type Void.
*/
Mono publishEvent(String pubsubName, String topicName, Object data);
/**
* Publish an event.
*
* @param pubsubName the pubsub name we will publish the event to
* @param topicName the topicName where the event will be published.
* @param data the event's data to be published, use byte[] for skipping serialization.
* @param metadata The metadata for the published event.
* @return a Mono plan of type Void.
*/
Mono publishEvent(String pubsubName, String topicName, Object data, Map metadata);
/**
* Publish an event.
*
* @param request the request for the publish event.
* @return a Mono plan of a Dapr's void response.
*/
Mono publishEvent(PublishEventRequest request);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param data The data to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link io.dapr.client.domain.HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in data.
* @param type The Type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, Object data, HttpExtension httpExtension,
Map metadata, TypeRef type);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param clazz The type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Map metadata, Class clazz);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param type The Type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
TypeRef type);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param clazz The type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Class clazz);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param type The Type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map metadata,
TypeRef type);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param clazz The type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map metadata,
Class clazz);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type Void.
*/
Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Map metadata);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @return A Mono Plan of type Void.
*/
Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension);
/**
* Invoke a service method, using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type Void.
*/
Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map metadata);
/**
* Invoke a service method, without using serialization.
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type byte[].
*/
Mono invokeMethod(String appId, String methodName, byte[] request, HttpExtension httpExtension,
Map metadata);
/**
* Invoke a service method.
*
* @param invokeMethodRequest Request object.
* @param type The Type needed as return for the call.
* @param The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
Mono invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef type);
/**
* Invokes a Binding operation.
*
* @param bindingName The bindingName of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, use byte[] to skip serialization.
* @return an empty Mono.
*/
Mono invokeBinding(String bindingName, String operation, Object data);
/**
* Invokes a Binding operation, skipping serialization.
*
* @param bindingName The name of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, skipping serialization.
* @param metadata The metadata map.
* @return a Mono plan of type byte[].
*/
Mono invokeBinding(String bindingName, String operation, byte[] data, Map metadata);
/**
* Invokes a Binding operation.
*
* @param bindingName The name of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, use byte[] to skip serialization.
* @param type The type being returned.
* @param The type of the return
* @return a Mono plan of type T.
*/
Mono invokeBinding(String bindingName, String operation, Object data, TypeRef type);
/**
* Invokes a Binding operation.
*
* @param bindingName The name of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, use byte[] to skip serialization.
* @param clazz The type being returned.
* @param The type of the return
* @return a Mono plan of type T.
*/
Mono invokeBinding(String bindingName, String operation, Object data, Class clazz);
/**
* Invokes a Binding operation.
*
* @param bindingName The name of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, use byte[] to skip serialization.
* @param metadata The metadata map.
* @param type The type being returned.
* @param The type of the return
* @return a Mono plan of type T.
*/
Mono invokeBinding(String bindingName, String operation, Object data, Map metadata,
TypeRef type);
/**
* Invokes a Binding operation.
*
* @param bindingName The name of the biding to call.
* @param operation The operation to be performed by the binding request processor.
* @param data The data to be processed, use byte[] to skip serialization.
* @param metadata The metadata map.
* @param clazz The type being returned.
* @param The type of the return
* @return a Mono plan of type T.
*/
Mono invokeBinding(String bindingName, String operation, Object data, Map metadata,
Class clazz);
/**
* Invokes a Binding operation.
*
* @param request The binding invocation request.
* @param type The type being returned.
* @param The type of the return
* @return a Mono plan of type T.
*/
Mono invokeBinding(InvokeBindingRequest request, TypeRef type);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param state State to be re-retrieved.
* @param type The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, State state, TypeRef type);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param state State to be re-retrieved.
* @param clazz The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, State state, Class clazz);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param key The key of the State to be retrieved.
* @param type The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, String key, TypeRef type);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param key The key of the State to be retrieved.
* @param clazz The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, String key, Class clazz);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param key The key of the State to be retrieved.
* @param options Optional settings for retrieve operation.
* @param type The Type of State needed as return.
* @param The Type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, String key, StateOptions options, TypeRef type);
/**
* Retrieve a State based on their key.
*
* @param storeName The name of the state store.
* @param key The key of the State to be retrieved.
* @param options Optional settings for retrieve operation.
* @param clazz The Type of State needed as return.
* @param The Type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(String storeName, String key, StateOptions options, Class clazz);
/**
* Retrieve a State based on their key.
*
* @param request The request to get state.
* @param type The Type of State needed as return.
* @param The Type of the return.
* @return A Mono Plan for the requested State.
*/
Mono> getState(GetStateRequest request, TypeRef type);
/**
* Retrieve bulk States based on their keys.
*
* @param storeName The name of the state store.
* @param keys The keys of the State to be retrieved.
* @param type The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono>> getBulkState(String storeName, List keys, TypeRef type);
/**
* Retrieve bulk States based on their keys.
*
* @param storeName The name of the state store.
* @param keys The keys of the State to be retrieved.
* @param clazz The type of State needed as return.
* @param The type of the return.
* @return A Mono Plan for the requested State.
*/
Mono>> getBulkState(String storeName, List keys, Class clazz);
/**
* Retrieve bulk States based on their keys.
*
* @param request The request to get state.
* @param type The Type of State needed as return.
* @param The Type of the return.
* @return A Mono Plan for the requested State.
*/
Mono>> getBulkState(GetBulkStateRequest request, TypeRef type);
/** Execute a transaction.
*
* @param storeName The name of the state store.
* @param operations The operations to be performed.
* @return a Mono plan of type Void
*/
Mono executeStateTransaction(String storeName,
List> operations);
/** Execute a transaction.
*
* @param request Request to execute transaction.
* @return a Mono plan of type Response Void
*/
Mono executeStateTransaction(ExecuteStateTransactionRequest request);
/**
* Save/Update a list of states.
*
* @param storeName The name of the state store.
* @param states The States to be saved.
* @return a Mono plan of type Void.
*/
Mono saveBulkState(String storeName, List> states);
/**
* Save/Update a list of states.
*
* @param request Request to save states.
* @return a Mono plan of type Void.
*/
Mono saveBulkState(SaveStateRequest request);
/**
* Save/Update a state.
*
* @param storeName The name of the state store.
* @param key The key of the state.
* @param value The value of the state.
* @return a Mono plan of type Void.
*/
Mono saveState(String storeName, String key, Object value);
/**
* Save/Update a state.
*
* @param storeName The name of the state store.
* @param key The key of the state.
* @param etag The etag to be used.
* @param value The value of the state.
* @param options The Options to use for each state.
* @return a Mono plan of type Void.
*/
Mono saveState(String storeName, String key, String etag, Object value, StateOptions options);
/**
* Delete a state.
*
* @param storeName The name of the state store.
* @param key The key of the State to be removed.
* @return a Mono plan of type Void.
*/
Mono deleteState(String storeName, String key);
/**
* Delete a state.
*
* @param storeName The name of the state store.
* @param key The key of the State to be removed.
* @param etag Optional etag for conditional delete.
* @param options Optional settings for state operation.
* @return a Mono plan of type Void.
*/
Mono deleteState(String storeName, String key, String etag, StateOptions options);
/**
* Delete a state.
*
* @param request Request to delete a state.
* @return a Mono plan of type Void.
*/
Mono deleteState(DeleteStateRequest request);
/**
* Fetches a secret from the configured vault.
*
* @param storeName Name of vault component in Dapr.
* @param secretName Secret to be fetched.
* @param metadata Optional metadata.
* @return Key-value pairs for the secret.
*/
Mono