OxiGDAL Pub/Sub
Google Cloud Pub/Sub integration for OxiGDAL - Pure Rust streaming and messaging for geospatial data processing.
Overview
oxigdal-pubsub provides comprehensive support for Google Cloud Pub/Sub messaging, enabling real-time geospatial data streaming, event-driven processing, and distributed system communication.
Features
Core Capabilities
-
Publisher (~1,500 LOC)
- Async message publishing with batching
- Ordering keys for sequential message delivery
- Configurable retry logic with exponential backoff
- Flow control and backpressure handling
- Error handling and recovery
-
Subscriber (~1,500 LOC)
- Pull and push subscription models
- Message acknowledgment and negative acknowledgment
- Flow control with configurable limits
- Dead letter queue support
- Automatic acknowledgment deadline extension
-
Schema Support (~500 LOC) - feature-gated
- Apache Avro schema validation
- Protocol Buffers schema support
- Schema encoding and decoding
- Schema registry management
-
Monitoring (~300 LOC) - feature-gated
- Latency tracking and metrics collection
- Publisher and subscriber statistics
- Custom metric points with labels
- Metrics export for observability
-
Topic Management (~600 LOC)
- Topic creation and configuration
- Message retention policies
- Label management
- Topic statistics and metadata
-
Subscription Management (~700 LOC)
- Subscription creation and updates
- Expiration policies
- Dead letter policies
- Retry configurations
- Subscription seeking (timestamp/snapshot)
Pure Rust Implementation
This crate uses 100% Pure Rust implementations:
google-cloud-pubsub- Pure Rust Pub/Sub clientgoogle-cloud-auth- Pure Rust authenticationapache-avro- Pure Rust Avro support (optional)prost- Pure Rust Protocol Buffers (optional)
No C/Fortran dependencies - fully compliant with COOLJAPAN Pure Rust Policy.
COOLJAPAN Policy Compliance
- ✅ Pure Rust: 100% Pure Rust, no C/Fortran dependencies
- ✅ No unwrap(): All error handling uses
Result<T, E> - ✅ Files < 2000 lines: All source files under 2000 lines
- ✅ Workspace dependencies: Uses workspace-level dependency management
- ✅ Latest crates: Uses latest available versions from crates.io
Installation
Add to your Cargo.toml:
[]
= "0.1"
Feature Flags
[]
= "0.1"
= ["schema", "monitoring", "avro", "protobuf"]
Available features:
std(default) - Standard library supportasync(default) - Async runtime supportpublisher(default) - Publisher functionalitysubscriber(default) - Subscriber functionalityschema- Schema validation supportavro- Apache Avro schema supportprotobuf- Protocol Buffers schema supportmonitoring- Metrics and monitoringbatching- Message batchingordering- Message orderingflow-control- Flow controldead-letter- Dead letter queue support
Quick Start
Publishing Messages
use ;
async
Subscribing to Messages
use ;
async
Topic Management
use ;
async
Subscription Management
use ;
async
Schema Validation
use ;
use SchemaFormat;
async
Monitoring and Metrics
use ;
use Duration;
async
Architecture
Module Structure
oxigdal-pubsub/
├── src/
│ ├── lib.rs # Main library entry point
│ ├── error.rs # Error types and handling
│ ├── publisher.rs # Message publishing
│ ├── subscriber.rs # Message subscription
│ ├── topic.rs # Topic management
│ ├── subscription.rs # Subscription management
│ ├── schema.rs # Schema support (feature-gated)
│ └── monitoring.rs # Metrics and monitoring (feature-gated)
└── tests/
└── integration_test.rs # Integration tests
Performance Characteristics
- Batching: Automatically batches messages for optimal throughput
- Flow Control: Prevents overwhelming subscribers with configurable limits
- Retry Logic: Exponential backoff with configurable attempts
- Latency Tracking: Sub-millisecond precision for performance monitoring
- Memory Efficiency: Zero-copy operations where possible
Error Handling
All operations return Result<T, PubSubError> with comprehensive error types:
use PubSubError;
match publisher.publish.await
Testing
Run tests:
# Run all tests
# Run with all features
# Run specific test
Statistics
- Total Lines of Code: ~3,700 LOC
- Publisher: ~1,500 LOC
- Subscriber: ~1,500 LOC
- Topic Management: ~600 LOC
- Subscription Management: ~700 LOC
- Schema Support: ~500 LOC
- Monitoring: ~300 LOC
- Error Handling: ~400 LOC
- Tests: ~600 LOC
License
Apache-2.0
Authors
COOLJAPAN OU (Team Kitasan)
Contributing
This crate is part of the OxiGDAL project. Contributions are welcome!
See Also
- OxiGDAL Core - Core geospatial functionality
- OxiGDAL Cloud - Cloud storage integration
- OxiGDAL Distributed - Distributed computing
- OxiGDAL Streaming - Real-time data streaming