Crates.io | dsh_sdk |
lib.rs | dsh_sdk |
version | 0.4.10 |
source | src |
created_at | 2024-01-25 10:22:02.359068 |
updated_at | 2024-09-30 13:50:53.467622 |
description | SDK for KPN Data Services Hub |
homepage | https://www.kpn.com/dsh |
repository | https://github.com/kpn-dsh/dsh-sdk-platform-rs |
max_upload_size | |
id | 1113627 |
size | 293,231 |
This library can be used to interact with the DSH Platform. It is intended to be used as a base for services that will be used to interact with DSH. Features include:
Rdkafka and thereby this library is dependent on CMAKE. Make sure it is installed in your environment and/or Dockerfile where you are compiling. See dockerfile for an example.
To use this SDK with the default features in your project, add the following to your Cargo.toml file:
[dependencies]
dsh_sdk = "0.4"
However, if you would like to use only specific features, you can specify them in your Cargo.toml file. For example, if you would like to use only the bootstrap feature, add the following to your Cargo.toml file:
[dependencies]
dsh_sdk = { version = "0.4", default-features = false, features = ["bootstrap"] }
See feature flags for more information on the available features.
To use this SDK in your project
use dsh_sdk::Properties;
use dsh_sdk::rdkafka::consumer::{Consumer, StreamConsumer};
fn main() -> Result<(), Box<dyn std::error::Error>>{
let dsh_properties = Properties::get();
// get a rdkafka consumer config for example
let consumer: StreamConsumer = dsh_properties.consumer_rdkafka_config().create()?;
}
The SDK is compatible with running in a container on a DSH tenant, on DSH System Space, on a machine with Kafka Proxy/VPN or on a local machine to a local Kafka. See CONNECT_PROXY_VPN_LOCAL for more info.
The following features are available in this library and can be enabled/disabled in your Cargo.toml file.:
feature | default | Description |
---|---|---|
bootstrap |
✓ | Generate signed certificate and fetch datastreams info Also makes certificates available, to be used as lowlevel API |
rest-token-fetcher |
✗ | Fetch tokens to use DSH Rest API |
mqtt-token-fetcher |
✗ | Fetch tokens to use DSH MQTT |
metrics |
✓ | Enable (custom) metrics for your service |
graceful_shutdown |
✓ | Create a signal handler for implementing a graceful shutdown |
dlq |
✗ | Dead Letter Queue implementation (experimental) |
rdkafka-ssl |
✓ | Dynamically link to librdkafka to a locally installed OpenSSL |
rdkafka-ssl-vendored |
✗ | Build OpenSSL during compile and statically link librdkafka (No initial install required in environment, slower compile time) |
See api documentation for more information on how to use these features including.
The default RDKafka config can be overwritten by setting environment variables. See ENV_VARIABLES.md for more information.
See the api documentation for more information on how to use this library.
See folder dsh_sdk/examples for simple examples on how to use the SDK.
See folder example_dsh_service for a full service, including how to build the Rust project and post it to Harbor. See readme for more information.
See CHANGELOG.md for all changes per version.
See CONTRIBUTING.md for more information on how to contribute to this project.
See LICENSE for more information on the license for this project.
See SECURITY.md for more information on the security policy for this project.
Copyright (c) Koninklijke KPN N.V.