|
| 1 | +## Broker Configuration |
| 2 | + |
| 3 | +### Background |
| 4 | + |
| 5 | +Feedback-Fusion employs an event-driven architecture where the main server component emits events that need to be processed asynchronously. |
| 6 | +The indexer service handles the actual processing of these events. Communication between these components flows through a broker system that ensures reliable message delivery and decouples event production from consumption. |
| 7 | + |
| 8 | +The broker implementation offers two distinct approaches: |
| 9 | + |
| 10 | +- **gRPC**: Designed for smaller deployments where simplicity matters more than scale. The server sends asynchronous gRPC requests to the indexer, |
| 11 | +which processes events and returns responses after completion. This approach works well for single-instance setups but doesn't scale horizontally since each server instance needs to communicate with specific indexer instances. |
| 12 | + |
| 13 | +- **Fluvio**: Built for high-performance scenarios requiring horizontal scalability. Events are published to a distributed streaming platform |
| 14 | +where multiple indexer instances can consume and process them concurrently. This enables dynamic scaling based on workload and provides better fault tolerance. |
| 15 | +Fluvio is essentially a faster, more modern alternative to Apache Kafka. See [fluvio.io](https://fluvio.io) for more details. |
| 16 | + |
| 17 | +Choose gRPC for development environments or small production setups where operational simplicity is preferred. Select Fluvio when you need to handle high event volumes across multiple server and indexer instances. |
| 18 | + |
| 19 | +### Configuration |
| 20 | + |
| 21 | +#### Fluvio Driver |
| 22 | + |
| 23 | +Configure Fluvio as your broker driver for scalable, distributed event processing: |
| 24 | + |
| 25 | +```hcl |
| 26 | +broker = { |
| 27 | + fluvio = { |
| 28 | + topic = "feedback-fusion" |
| 29 | + |
| 30 | + fluvio = { |
| 31 | + endpoint = "127.0.0.1:9003" |
| 32 | + use_spu_local_address = false |
| 33 | + |
| 34 | + tls = { |
| 35 | + tls_policy = "disabled" |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + batch_interval = 0 |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +#### gRPC Driver |
| 45 | + |
| 46 | +Configure gRPC as your broker driver for simple, direct communication: |
| 47 | + |
| 48 | +```hcl |
| 49 | +broker = { |
| 50 | + grpc = { |
| 51 | + endpoint = "https://grpc.example.com" |
| 52 | + tls = { |
| 53 | + key = "/path/to/key.pem" |
| 54 | + certificate = "/path/to/certificate.pem" |
| 55 | + certificate_authority = "/path/to/ca.pem" |
| 56 | + } |
| 57 | + } |
| 58 | + max_batch_size = 10 |
| 59 | + batch_interval = 1000 |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +### Configuration Reference |
| 64 | + |
| 65 | +#### Top-Level Parameters |
| 66 | + |
| 67 | +| Parameter | Description | Default | Data Type | |
| 68 | +|-----------|-------------|---------|-----------| |
| 69 | +| fluvio | Fluvio broker driver configuration | N/A | Object | |
| 70 | +| grpc | gRPC broker driver configuration | N/A | Object | |
| 71 | +| max_batch_size | Maximum number of messages to process in a single batch | 10 | Integer | |
| 72 | +| batch_interval | Time interval in milliseconds to wait before processing a batch | 1000 | Integer | |
| 73 | + |
| 74 | +#### Fluvio Configuration |
| 75 | + |
| 76 | +| Parameter | Description | Default | Data Type | |
| 77 | +|-----------|-------------|---------|-----------| |
| 78 | +| fluvio | Fluvio cluster configuration object. See [FluvioClusterConfig](https://docs.rs/fluvio/latest/fluvio/config/struct.FluvioClusterConfig.html) for available options | N/A | Object | |
| 79 | +| topic | Topic name for event streams | "feedback-fusion" | String | |
| 80 | + |
| 81 | +#### gRPC Configuration |
| 82 | + |
| 83 | +| Parameter | Description | Default | Data Type | |
| 84 | +|-----------|-------------|---------|-----------| |
| 85 | +| endpoint | gRPC server endpoint URL | N/A | String | |
| 86 | +| tls | TLS configuration for secure communication | N/A | Object | |
| 87 | + |
| 88 | +#### TLS Configuration |
| 89 | + |
| 90 | +| Parameter | Description | Default | Data Type | |
| 91 | +|-----------|-------------|---------|-----------| |
| 92 | +| key | Path to TLS private key file | N/A | String | |
| 93 | +| certificate | Path to TLS certificate file | N/A | String | |
| 94 | +| certificate_authority | Path to CA certificate file | N/A | String | |
| 95 | + |
| 96 | +**Important**: You must configure exactly one broker driver. Choose either `fluvio` or `grpc` - configuring both will result in an error. |
0 commit comments