2 releases

0.1.2 Feb 12, 2024
0.1.1 Jan 25, 2024

#123 in HTTP server

Download history 27/week @ 2024-01-24 12/week @ 2024-01-31 30/week @ 2024-02-07 85/week @ 2024-02-14

154 downloads per month

Apache-2.0

93KB
1.5K SLoC

dsh-sdk-platform-rs

Build Status codecov dependency status License

Description

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. It is not intended to be used directly. Features include:

  • Connect to DSH
  • Fetch Kafka Properties (datastream)
  • Common functions
    • Preconfigured RDKafka client config
    • Preconfigured Reqwest client config (for schema store)
  • Graceful shutdown
  • Prometheus Metrics (web server and re-export of metrics crate)
  • Dead Letter Queue (experimental)

Usage

To use this SDK with the default features in your project, add the following to your Cargo.toml file:

[dependencies]
dsh_sdk = "0.1"

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.1", 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::dsh::Properties;

#[tokio::main]
async fn main() {
    let dsh_properties = Properties::new().await.unwrap();
    // get a rdkafka consumer config for example
    let consumer_config = dsh_properties.consumer_rdkafka_config().create().unwrap();
}

Api doc

See the api documentation for more information on how to use this library.

Local development

Add a local_datastreams.json to your project root.

Note

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 in example_dsh_service for an example.

Examples

See folder examples for simple examples on how to use the SDK.

Full service example

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.

Feauture flags

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
local Use the SDK in your local environment*
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.

* Requires a local_datastreams.json in your project root.

Changelog

See CHANGELOG.md for all changes per version.

Contributing

See CONTRIBUTING.md for more information on how to contribute to this project.

License

See LICENSE for more information on the license for this project.

Security

See SECURITY.md for more information on the security policy for this project.


Copyright (c) Koninklijke KPN N.V.

Dependencies

~0.5–21MB
~325K SLoC