pub struct SenderBuilder { /* private fields */ }
Expand description

Accumulate parameters for a new Sender instance.

use questdb::ingress::SenderBuilder;
 
let mut sender = SenderBuilder::new("localhost", 9009).connect()?;

Additional options for:

Implementations

QuestDB server and port.

use questdb::ingress::SenderBuilder;
 
let mut sender = SenderBuilder::new("localhost", 9009).connect()?;

Select local outbound interface.

This may be relevant if your machine has multiple network interfaces.

If unspecified, the default is to use any available interface and is equivalent to calling:

let mut sender = SenderBuilder::new("localhost", 9009)
    .net_interface("0.0.0.0")
    .connect()?;

Authentication Parameters.

If not called, authentication is disabled.

Arguments
  • key_id - Key identifier, AKA “kid” in JWT. This is sometimes referred to as the username.
  • priv_key - Private key, AKA “d” in JWT.
  • pub_key_x - X coordinate of the public key, AKA “x” in JWT.
  • pub_key_y - Y coordinate of the public key, AKA “y” in JWT.
Example
let mut sender = SenderBuilder::new("localhost", 9009)
    .auth(
        "testUser1",                                    // kid
        "5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48",  // d
        "fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU",  // x
        "Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac")  // y 
    .connect()?;

Follow the QuestDB authentication documentation for instructions on generating keys.

Configure TLS handshake.

The default is Tls::Disabled.

let mut sender = SenderBuilder::new("localhost", 9009)
    .tls(Tls::Disabled)
    .connect()?;

To enable with commonly accepted certificates, use:

use questdb::ingress::CertificateAuthority;
 
let mut sender = SenderBuilder::new("localhost", 9009)
    .tls(Tls::Enabled(CertificateAuthority::WebpkiRoots))
    .connect()?;

To use self-signed certificates:

use questdb::ingress::CertificateAuthority;
use std::path::PathBuf;
 
let mut sender = SenderBuilder::new("localhost", 9009)
    .tls(Tls::Enabled(CertificateAuthority::File(
        PathBuf::from("/path/to/server_rootCA.pem"))))
    .connect()?;

If you’re still struggling you may temporarily enable the dangerous insecure-skip-verify feature to skip the certificate verification:

let mut sender = SenderBuilder::new("localhost", 9009)
   .tls(Tls::InsecureSkipVerify)
   .connect()?;

Configure how long to wait for messages from the QuestDB server during the TLS handshake and authentication process. The default is 15 seconds.

use std::time::Duration;
 
let mut sender = SenderBuilder::new("localhost", 9009)
   .read_timeout(Duration::from_secs(15))
   .connect()?;

Connect synchronously.

Will return once the connection is fully established: If the connection requires authentication or TLS, these will also be completed before returning.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.