Event-DrivenMultimodalDispatchEngine
Sub-millisecond route optimization, live train-consist geofencing, and automated intermodal manifest reconciliation.
The Brief
Apex Intermodal Logistics coordinates over 12,000 daily container shipments spanning Class I rail lines, deep-water port terminals, and regional drayage fleets. Their legacy batch dispatching engine ran on a 30-minute processing cycle, which meant that rail arrival delays, customs inspections, and port gate congestion triggered cascading truck idling fees and missed rail windows across North America.
The business faced mounting demurrage penalties exceeding $420,000 per month due to information lag between port drayage dispatchers and long-haul rail schedulers. A dispatch error on a single train consist could ripple into hundreds of delayed refrigerated container pickups.
Apache Spark was brought in to architect and build a real-time, event-driven multimodal dispatch platform capable of recalculating optimal routes, yard assignments, and driver dispatches within milliseconds of any physical disruption.
Engineering Approach
We engineered an event-driven dispatch core written in Rust, leveraging Apache Kafka for high-throughput manifest ingestion and NATS for low-latency operational event distribution. We built a custom constraint solver utilizing spatial indexing in memory that continuously evaluates tractor GPS coordinates, chassis availability, driver hours-of-service, and terminal queue depth. Real-time updates are pushed to regional dispatchers and driver mobile terminals via persistent WebSocket connections with offline-first synchronization.
Operational Outcome
Route recalculation latency dropped from 28 minutes to 48 milliseconds. Empty trailer repositioning miles dropped by 18.4%, and month-over-month demurrage penalties were cut by $380,000 within ninety days of cutover.
Schematic Delivery Pipeline
EDI 214 and 410 feeds stream from rail carriers into partitioned Kafka ingestion queues.
In-memory R-tree indexes evaluate GPS coordinates against geofenced terminal boundaries.
Rust scheduling engine calculates optimal driver-chassis assignments in sub-50ms cycles.
Encrypted WebSocket pipelines deliver step-by-step turn manifests to driver in-cab terminals.
Legacy vs Modernized Architecture
Technical Plates & Trace Graphs
Terminal dispatch interface displaying live yard slot allocations and drayage queues.
Geofence transition telemetry showing microsecond event correlation.
System latency histogram comparing legacy batch vs event-driven execution.
“The speed of the new dispatch engine gave our operations team a competitive weapon. We went from reacting to rail delays an hour late to adjusting routes before the train has even pulled into the switchyard.”