|
5 | 5 | - Basic usage |
6 | 6 |
|
7 | 7 | ```c# |
8 | | -using var ls = new LineTcpSender(IPAddress.Loopback.ToString(), 9009); |
| 8 | +using var ls = await LineTcpSender.ConnectAsync("localhost", 9009, tlsMode: TlsMode.Disable); |
9 | 9 | ls.Table("metric_name") |
10 | 10 | .Symbol("Symbol", "value") |
11 | | - .Colum("number", 10) |
12 | | - .Colum("double", 12.23) |
13 | | - .Colum("string", "born to shine") |
| 11 | + .Column("number", 10) |
| 12 | + .Column("double", 12.23) |
| 13 | + .Column("string", "born to shine") |
14 | 14 | .At(new DateTime(2021, 11, 25, 0, 46, 26)); |
15 | | -ls.Flush(); |
| 15 | +await ls.SendAsync(); |
16 | 16 | ``` |
17 | 17 |
|
18 | 18 | - Multi-line send |
19 | 19 |
|
20 | 20 | ```c# |
21 | | -using var ls = new LineTcpSender(IPAddress.Loopback.ToString(), 9009); |
| 21 | +using var ls = new LineTcpSender("localhost", 9009, tlsMode: TlsMode.Disable); |
22 | 22 | for(int i = 0; i < 1E6; i++) |
23 | 23 | { |
24 | 24 | ls.Table("metric_name") |
25 | | - .Colum("counter", i) |
| 25 | + .Column("counter", i) |
26 | 26 | .AtNow(); |
27 | 27 | } |
28 | | -ls.Flush(); |
| 28 | +ls.Send(); |
29 | 29 | ``` |
| 30 | + |
| 31 | +- Authenticated |
| 32 | +```c# |
| 33 | + using var ls = new LineTcpSender("localhost", 9009); |
| 34 | + await ls.Authenticate("admin", "NgdiOWDoQNUP18WOnb1xkkEG5TzPYMda5SiUOvT1K0U="); |
| 35 | + ls.Table("metric_name") |
| 36 | + .Column("counter", i) |
| 37 | + .AtNow(); |
| 38 | +await ls.SendAsync(); |
| 39 | +``` |
| 40 | + |
| 41 | +- Fixed IO Buffer size |
| 42 | +```c# |
| 43 | + using var ls = new LineTcpSender("localhost", 9009, bufferOverflowHandling: BufferOverflowHandling.SendImmediately); |
| 44 | + await ls.Authenticate("admin", "NgdiOWDoQNUP18WOnb1xkkEG5TzPYMda5SiUOvT1K0U="); |
| 45 | + ls.Table("metric_name") |
| 46 | + .Column("counter", i) |
| 47 | + .AtNow(); |
| 48 | +await ls.SendAsync(); |
| 49 | +``` |
| 50 | + |
| 51 | +### Construction parameters |
| 52 | + |
| 53 | +| Name | Default | Description | |
| 54 | +|--------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 55 | +| `host` | | Host or IP address of QuestDB server | |
| 56 | +| `port` | | QuestDB Port. Default ILP port is 9009 | |
| 57 | +| `bufferSize` | 4096 | Default send buffer size | |
| 58 | +| `bufferOverflowHandling` | `Extend` | There are 2 modes: <br/> - `Extend` will grow input buffer until `Send()` or `SendAsync()` method called<br/> - `SendImmediately` will no extend the IO Buffer and automatically executes `Send()` immediatly when IO Buffer overflown | |
| 59 | +| `tslMode` | `Enable` | There are 3 TSL modes:<br/>- `Enable`. TLS is enabled, sever certificate is checked<br/> - `AllowAnyServerCertificate`. TLS enabled, server certificate is not checked<br/>- `Disable` | |
| 60 | + |
| 61 | +### Properties and methods |
| 62 | + |
| 63 | +| Name | Description | |
| 64 | +|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------| |
| 65 | +| `AuthenticateAsync(string keyId, string privateKey)` | Authenticates with QuestDB certificates | |
| 66 | +| `Table(string name)` | Starts new line from table name | |
| 67 | +| `Symbol(string sybolName, string value)` | Symbol column value | |
| 68 | +| `Column(stirng columnName, string / long / double / DateTime value)` | Column name and value | |
| 69 | +| `At(DateTime / long timestamp)` | Designated timestamp for the line | |
| 70 | +| `AtNow()` | Finishes line leaving QuestDB sever to set the timestamp | |
| 71 | +| `Send() / SendAsync() ` | Send IO Buffers to QuestDB | |
| 72 | +| `CancelLine()` | Cancels current line. Works only when `bufferOverflowHandling` set to `Extend` | |
| 73 | +| `TrimExcessBuffers()` | Trims empty buffers used to grow IO Buffer. Only useful when `bufferOverflowHandling` set to `Extend` | |
| 74 | +| int `WriteTimeout` | Value, in milliseconds, that determines how long the underlying stream will attempt to write before timing out | |
| 75 | +| `IsConnected` | Indicates if the connection to QuestDB open | |
0 commit comments