cleancode/simple-bus-on-steroids
event_id, correlation_id, parent_id, and occurrence_time is valuable for auditing, debugging, and event sourcing, but requires schema changes and potential adjustments to existing event structures.Event::dispatch()) and supports queue workers (php artisan queue:work).events), which may conflict with Laravel’s existing event storage (if using events table for logging).events table could clash with Laravel’s default event logging or third-party packages (e.g., spatie/laravel-activitylog).events table).Event::dispatch() to use SimpleBus.// In a service provider:
$eventBus = new SimpleBusOnSteroidsBus();
Event::macro('dispatchWithBus', function ($event) use ($eventBus) {
$eventBus->publish($event);
});
php artisan queue:work with a custom consumer that pulls from RabbitMQ (or use Laravel’s queue workers with a bridge).CREATE TABLE events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
event_id VARCHAR(255),
correlation_id VARCHAR(255),
parent_id VARCHAR(255),
occurrence_time DATETIME,
payload TEXT,
status VARCHAR(50),
-- other metadata
);
events table.composer require cleancode/simple-bus-on-steroids).events table requires migrations and may need updates if the package evolves..env or config files).events table if scaling writes.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| RabbitMQ Unavailable | Events stall in DB or are lost. | Fallback to Laravel’s queue driver; use a circuit breaker. |
| Database Connection Issues | Events not persisted; transactions fail. | Retry logic with exponential backoff; monitor DB health. |
| Subscriber Crashes | Partial event processing; DLQ overflow. | Configure max retries and DLQ alerts; implement circuit breakers. |
| Schema Corruption | Event metadata becomes inconsistent. | Regular backups; use migrations carefully. |
| High Event Volume | Database locks; RabbitMQ overload. | Optimize transaction isolation; scale RabbitMQ/consumers. |
| Missing Correlation IDs | Debugging event flows becomes difficult. | Enforce metadata in all events |
How can I help you explore Laravel packages today?