aboutsummaryrefslogtreecommitdiffstats
path: root/includes/DomainEvent/DomainEventDispatcher.php
blob: 9bae3d17f8078043d581b05a0ba8d34cfa225559 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace MediaWiki\DomainEvent;

use Wikimedia\Rdbms\IConnectionProvider;

/**
 * Service for sending domain events to registered listeners.
 *
 * @since 1.44
 * @unstable until 1.45
 */
interface DomainEventDispatcher {

	/**
	 * Dispatch the given event to any listeners that have been registered for
	 * the given event type. The event will be dispatched to registered listeners
	 * later, after (and if) the current transaction in $dbw has been committed
	 * successfully. No listeners will be invoked within the current transaction.
	 *
	 * Implementations should aim to provide at-least-once delivery semantics,
	 * but guaranteed delivery is not a hard requirement of this interface.
	 * An application may guarantee delivery of domain events by providing
	 * an appropriate implementation (a transactional outbox).
	 */
	public function dispatch(
		DomainEvent $event,
		IConnectionProvider $dbProvider
	): void;

}