MCPcopy Create free account
hub / github.com/Rustixir/tokio_sky / main

Function main

examples/batch_insert_mysql.rs:5–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4#[tokio::main]
5async fn main() {
6
7 let producer_factory = || Prod;
8 let producer_concurrency = 3;
9 let producer_router = RouterType::RoundRobin;
10 let producer_buffer_pool = 100;
11
12
13 let proc_factory = || Layer1Process;
14 let proc_concurrency = 3;
15 let proc_router = RouterType::Partition;
16 let proc_buffer_size = 10;
17
18
19 // Mysql Config
20 let database_url = "...";
21 let pool = mysql_async::Pool::new(database_url);
22
23
24 let batcher_factory = || MysqlBatcher::new(pool);
25 let batcher_concurrency = 2;
26 let batcher_buffer_size = 10;
27 let batcher_batch_size = 10;
28 let batcher_batch_timeout: BATCH_TIMEOUT;
29
30 // / processor-1 \
31 // / \
32 // producer-1 / -----> MysqlBatcher[fullname]
33 // producer-2 ---- processor-2
34 // producer-3 \ -----> MysqlBatcher[fullname]
35 // \ /
36 // \ processor-3 /
37
38
39 let safe_shutdown =
40 run_topology_1_with_batcher(
41 producer_factory,
42 producer_concurrency,
43 producer_router,
44 producer_buffer_pool,
45
46 proc_factory,
47 proc_concurrency,
48 proc_router,
49 proc_buffer_size,
50
51 batcher_factory,
52 batcher_concurrency,
53 batcher_buffer_size,
54 batcher_batch_size,
55 batcher_batch_timeout
56 );
57
58
59 // Safe Shutdown from (Producer) to (Layer_X_Processor)
60 safe_shutdown.send(());
61
62

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected