pub struct Client<C>{ /* private fields */ }
Expand description
Schema registry client implementation.
Implementations§
Source§impl<C> Client<C>
impl<C> Client<C>
Sourcepub fn new(application_context: ApplicationContext, client: &C) -> Self
pub fn new(application_context: ApplicationContext, client: &C) -> Self
Create a new Schema Registry Client.
§Panics
Panics if the options for the underlying command invokers cannot be built. Not possible since the options are statically generated.
Sourcepub async fn get(
&self,
get_request: GetRequest,
timeout: Duration,
) -> Result<Option<Schema>, Error>
pub async fn get( &self, get_request: GetRequest, timeout: Duration, ) -> Result<Option<Schema>, Error>
Retrieves schema information from a schema registry service.
§Arguments
get_request
- The request to get a schema from the schema registry.timeout
- The duration until the Schema Registry Client stops waiting for a response to the request, it is rounded up to the nearest second.
Returns a Schema
if the schema was found, otherwise returns None
.
§Errors
Error
of kind InvalidArgument
if the timeout
is zero or > u32::max
, or there is an error building the request.
Error
of kind SerializationError
if there is an error serializing the request.
Error
of kind ServiceError
if there is an error returned by the Schema Registry Service.
Error
of kind AIOProtocolError
if there are any underlying errors from the AIO RPC protocol.
Sourcepub async fn put(
&self,
put_request: PutRequest,
timeout: Duration,
) -> Result<Schema, Error>
pub async fn put( &self, put_request: PutRequest, timeout: Duration, ) -> Result<Schema, Error>
Adds or updates a schema in the schema registry service.
§Arguments
put_request
- The request to put a schema in the schema registry.timeout
- The duration until the Schema Registry Client stops waiting for a response to the request, it is rounded up to the nearest second.
Returns the Schema
that was put if the request was successful.
§Errors
Error
of kind InvalidArgument
if the content
is empty, the timeout
is zero or > u32::max
, or there is an error building the request.
Error
of kind SerializationError
if there is an error serializing the request.
Error
of kind ServiceError
if there is an error returned by the Schema Registry Service.
Error
of kind AIOProtocolError
if there are any underlying errors from the AIO RPC protocol.
Sourcepub async fn shutdown(&self) -> Result<(), Error>
pub async fn shutdown(&self) -> Result<(), Error>
Shutdown the Client
. Shuts down the underlying command invokers for get and put operations.
Note: If this method is called, the Client
should not be used again.
If the method returns an error, it may be called again to re-attempt unsubscribing.
Returns Ok(()) on success, otherwise returns Error
.
§Errors
Error
of kind AIOProtocolError
if the unsubscribe fails or if the unsuback reason code doesn’t indicate success.