src/Provider/AwsProvider.php
public function topicExists()
    {
        if (isset($this->topicArn)) {
            return true;
        }

        $key = $this->getNameWithPrefix() . '_arn';
        if ($this->cache->contains($key)) {
            $this->topicArn = $this->cache->fetch($key);

            return true;
        }

        if (!empty($this->queueUrl)) {
            $queueArn = $this->sqs->getQueueArn($this->queueUrl);
            $topicArn = str_replace('sqs', 'sns', $queueArn);

            try {
                $this->sns->getTopicAttributes([
                    'TopicArn' => $topicArn
                ]);
            } catch (SnsException $e) {
                return false;
            }

            $this->topicArn = $topicArn;
            $this->cache->save($key, $this->topicArn);

            return true;
        }

        return false;
    }
public function topicExists()
    {
        if (isset($this->topicArn)) {
            return true;
        }

        $key = $this->getNameWithPrefix() . '_arn';
        if ($this->cache->contains($key)) {
            $this->topicArn = $this->cache->fetch($key);

            return true;
        }

        if (!empty($this->queueUrl)) {
            $queueArn = $this->sqs->getQueueArn($this->queueUrl);
            $topicArn = str_replace('sqs', 'sns', $queueArn);

            try {
                $this->sns->getTopicAttributes([
                    'TopicArn' => $topicArn
                ]);
            } catch (SnsException $e) {
                return false;
            }

            $this->topicArn = $topicArn;
            $this->cache->save($key, $this->topicArn);

            return true;
        }

        return false;
    }
public function topicExists ( ) { if ( isset ( $ this -> topicArn ) ) { return true ; } $ key = $ this -> getNameWithPrefix ( ) . '_arn' ; if ( $ this -> cache -> contains ( $ key ) ) { $ this -> topicArn = $ this -> cache -> fetch ( $ key ) ; return true ; } if ( ! empty ( $ this -> queueUrl ) ) { $ queueArn = $ this -> sqs -> getQueueArn ( $ this -> queueUrl ) ; $ topicArn = str_replace ( 'sqs' , 'sns' , $ queueArn ) ; try { $ this -> sns -> getTopicAttributes ( [ 'TopicArn' => $ topicArn ] ) ; } catch ( SnsException $ e ) { return false ; } $ this -> topicArn = $ topicArn ; $ this -> cache -> save ( $ key , $ this -> topicArn ) ; return true ; } return false ; }
Checks to see if a Topic exists

This method relies on in-memory cache and the Cache provider
to reduce the need to needlessly call the create method on an existing
Topic.

@return boolean
Checks to see if a Topic exists