public function getPublisherForMessage(Message $message)
    {
        $attributes = $message->getAttributes();
        if (!isset($attributes['headers']) || !isset($attributes['headers'][$this->headerName])) {
            throw MissingPublisherException::noHeaderInMessage($message, $this->headerName);
        }

        $value = $attributes['headers'][$this->headerName];
        foreach ($this->valueMap as $hash => $values) {
            if (!in_array($value, $values, true)) {
                continue;
            }

            return $this->publishers[$hash];
        }

        throw MissingPublisherException::noKnownPublisherFor($message);
    }