Skip to content

Parallel Handlers

  • Back to Testing Overview

    Return to the Testing overview page with all topics.

    Back to Overview

Both handler classes are on invocations. Do not assert their order.

See Parallel Event Processing.

async with test_harness(
    container,
    commands_mapper=commands_mapper,
    domain_events_mapper=domain_events_mapper,
    concurrent_event_handle_enable=True,
    scope_strategy=cqrs.ScopeStrategy.HANDLER,
) as harness:
    await harness.mediator.send(CreateOrder(sku="book"))
    harness.invocations.assert_entered(AuditHandler)
    harness.invocations.assert_entered(SearchHandler)

Library example: examples/testing/parallel_handlers.py.