# setApplicationEventBus abstract method

void setApplicationEventBus(

1. ApplicationEventBus applicationEventBus

)

Sets the ApplicationEventBus for this application context.

The event bus is the central hub for event-driven communication within the application, supporting both synchronous and asynchronous event processing patterns.

### Event Bus Capabilities:

- Event Publication: Publish events to registered listeners
- Listener Registration: Dynamic listener management
- Error Handling: Configurable error handling strategies
- Filtering: Event filtering and conditional delivery
- Ordering: Listener execution order control

### Typical initialization:

    // Create and configure event bus
    final eventBus = ApplicationEventBus();
    eventBus.setErrorHandler((event, listener, error) {
      logger.error('Event delivery failed', error: error);
    });

    context.setApplicationEventBus(eventBus);

    // Usage in application components
    class OrderService {
      final ApplicationEventBus eventBus;

      OrderService(this.eventBus);

      Future<Order> processOrder(Order order) async {
        // Business logic...

        // Publish domain event
        eventBus.publish(OrderProcessedEvent(this, order));

        return order;
      }
    }

## Implementation

    void setApplicationEventBus(ApplicationEventBus applicationEventBus);