public function isMatchedBy(DomainMessage $domainMessage): bool
    {
        if ($this->aggregateRootTypes) {
            throw new CriteriaNotSupportedException(
                'Cannot match criteria based on aggregate root types.'
            );
        }

        if ($this->aggregateRootIds && !in_array($domainMessage->getId(), $this->aggregateRootIds)) {
            return false;
        }

        if ($this->eventTypes && !in_array($domainMessage->getType(), $this->eventTypes)) {
            return false;
        }

        return true;
    }