Skip to content

Commit 3f50c76

Browse files
committed
Service-based classes
1 parent d2f4b86 commit 3f50c76

File tree

2 files changed

+449
-16
lines changed

2 files changed

+449
-16
lines changed

reference/extending/index.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Learn how to build custom services and processors for TrustGraph.
1212

1313
## Base Classes
1414

15-
TrustGraph provides two main base classes for building extension services:
15+
TrustGraph provides multiple levels of abstraction for building extension services:
1616

1717
### [AsyncProcessor](async-processor.md)
1818
For building global services that operate independently of flow management. Best for:
@@ -28,24 +28,45 @@ For building flow-aware services that integrate with TrustGraph's processing pip
2828
- Services that need dynamic reconfiguration
2929
- Services with multiple input/output streams
3030

31+
### [Service Base Classes](service-base-classes.md)
32+
Pre-built service templates that extend FlowProcessor for common patterns. Best for:
33+
- Standard service types (LLM, embeddings, storage, query)
34+
- Rapid development with minimal boilerplate
35+
- Consistent service patterns across your system
36+
- Built-in error handling and metrics
37+
3138
## Choosing the Right Base Class
3239

33-
| Use Case | AsyncProcessor | FlowProcessor |
34-
|----------|---------------|---------------|
35-
| Global services || |
36-
| Flow-based processing | ||
37-
| Request/response patterns |||
38-
| Multiple concurrent flows | ||
39-
| Dynamic flow configuration | ||
40-
| Simple message handling || |
41-
| Complex pipeline integration | ||
40+
| Use Case | AsyncProcessor | FlowProcessor | Service Base Classes |
41+
|----------|---------------|---------------|---------------------|
42+
| Global services || | |
43+
| Flow-based processing | |||
44+
| Request/response patterns ||||
45+
| Multiple concurrent flows | |||
46+
| Dynamic flow configuration | |||
47+
| Simple message handling || | |
48+
| Complex pipeline integration | |||
49+
| Standard service patterns | | ||
50+
| Minimal boilerplate | | ||
51+
| Built-in error handling | | ||
4252

4353
## Getting Started
4454

45-
1. **Choose your base class** based on your service requirements
46-
2. **Implement the required methods** for message handling and lifecycle management
47-
3. **Register specifications** (for FlowProcessor) or set up consumers/producers (for AsyncProcessor)
48-
4. **Add command-line arguments** for configuration
49-
5. **Create an entry point** for your service
55+
1. **Choose your base class** based on your service requirements:
56+
- **Service Base Classes**: For standard patterns (LLM, embeddings, storage, etc.)
57+
- **FlowProcessor**: For custom flow-aware services
58+
- **AsyncProcessor**: For global services outside the flow system
59+
60+
2. **Implement the required methods**:
61+
- Service Base Classes: One core method (e.g., `generate_content`, `invoke_tool`)
62+
- FlowProcessor: Message handlers and specifications
63+
- AsyncProcessor: Consumers, producers, and lifecycle management
64+
65+
3. **Configure your service**:
66+
- Add command-line arguments for configuration
67+
- Set up any required dependencies
68+
- Configure concurrency if supported
69+
70+
4. **Create an entry point** for your service
5071

51-
Both base classes handle the underlying infrastructure including Pulsar messaging, configuration management, metrics collection, and error handling, allowing you to focus on your service's core logic.
72+
All base classes handle the underlying infrastructure including Pulsar messaging, configuration management, metrics collection, and error handling, allowing you to focus on your service's core logic.

0 commit comments

Comments
 (0)