PHP Class Uecode\Bundle\QPushBundle\Provider\AwsProvider

Author: Keith Kirk ([email protected])
Inheritance: extends AbstractProvider
ファイルを表示 Open project: uecode/qpush-bundle

Public Methods

Method Description
__construct ( $name, array $options, $client, Doctrine\Common\Cache\Cache $cache, Logger $logger )
create ( ) Builds the configured queues
createQueue ( ) : string Creates an SQS Queue and returns the Queue Url
createSqsPolicy ( ) : string Creates a Policy for SQS that's required to allow SNS SendMessage access
createTopic ( ) : false | null Creates a SNS Topic and returns the ARN
delete ( $id ) : boolean {@inheritDoc}
destroy ( ) : boolean
getProvider ( )
getTopicSubscriptions ( string $topicArn ) : array Get a list of Subscriptions for the specified SNS Topic
onMessageReceived ( Uecode\Bundle\QPushBundle\Event\MessageEvent $event ) : boolean | void Removes the message from queue after all other listeners have fired
onNotification ( Uecode\Bundle\QPushBundle\Event\NotificationEvent $event, string $eventName, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) : boolean | void Handles SNS Notifications
publish ( array $message, array $options = [] ) : string {@inheritDoc}
queueExists ( ) : boolean Return the Queue Url
receive ( array $options = [] ) {@inheritDoc}
subscribeToTopic ( string $topicArn, string $protocol, string $endpoint ) : string Subscribes an endpoint to a SNS Topic
topicExists ( ) : boolean Checks to see if a Topic exists
unsubscribeFromTopic ( string $topicArn, string $protocol, string $endpoint ) : boolean Unsubscribes an endpoint from a SNS Topic

Method Details

__construct() public method

public __construct ( $name, array $options, $client, Doctrine\Common\Cache\Cache $cache, Logger $logger )
$options array
$cache Doctrine\Common\Cache\Cache
$logger Monolog\Logger

create() public method

If a Queue name is passed and configured, this method will build only that Queue. All Create methods are idempotent, if the resource exists, the current ARN will be returned
public create ( )

createQueue() public method

The create method for SQS Queues is idempotent - if the queue already exists, this method will return the Queue Url of the existing Queue.
public createQueue ( ) : string
return string

createSqsPolicy() public method

Creates a Policy for SQS that's required to allow SNS SendMessage access
public createSqsPolicy ( ) : string
return string

createTopic() public method

The create method for the SNS Topics is idempotent - if the topic already exists, this method will return the Topic ARN of the existing Topic.
public createTopic ( ) : false | null
return false | null

delete() public method

{@inheritDoc}
public delete ( $id ) : boolean
return boolean

destroy() public method

public destroy ( ) : boolean
return boolean

getProvider() public method

public getProvider ( )

getTopicSubscriptions() public method

Get a list of Subscriptions for the specified SNS Topic
public getTopicSubscriptions ( string $topicArn ) : array
$topicArn string The SNS Topic Arn
return array

onMessageReceived() public method

If an earlier listener has erred or stopped propagation, this method will not fire and the Queued Message should become visible in queue again. Stops Event Propagation after removing the Message
public onMessageReceived ( Uecode\Bundle\QPushBundle\Event\MessageEvent $event ) : boolean | void
$event Uecode\Bundle\QPushBundle\Event\MessageEvent The SQS Message Event
return boolean | void

onNotification() public method

For Subscription notifications, this method will automatically confirm the Subscription request For Message notifications, this method polls the queue and dispatches the {queue}.message_received event for each message retrieved
public onNotification ( Uecode\Bundle\QPushBundle\Event\NotificationEvent $event, string $eventName, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) : boolean | void
$event Uecode\Bundle\QPushBundle\Event\NotificationEvent The Notification Event
$eventName string Name of the event
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
return boolean | void

publish() public method

This method will either use a SNS Topic to publish a queued message or straight to SQS depending on the application configuration.
public publish ( array $message, array $options = [] ) : string
$message array
$options array
return string

queueExists() public method

This method relies on in-memory cache and the Cache provider to reduce the need to needlessly call the create method on an existing Queue.
public queueExists ( ) : boolean
return boolean

receive() public method

{@inheritDoc}
public receive ( array $options = [] )
$options array

subscribeToTopic() public method

Subscribes an endpoint to a SNS Topic
public subscribeToTopic ( string $topicArn, string $protocol, string $endpoint ) : string
$topicArn string The ARN of the Topic
$protocol string The protocol of the Endpoint
$endpoint string The Endpoint of the Subscriber
return string

topicExists() public method

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.
public topicExists ( ) : boolean
return boolean

unsubscribeFromTopic() public method

The method will return TRUE on success, or FALSE if the Endpoint did not have a Subscription on the SNS Topic
public unsubscribeFromTopic ( string $topicArn, string $protocol, string $endpoint ) : boolean
$topicArn string The ARN of the Topic
$protocol string The protocol of the Endpoint
$endpoint string The Endpoint of the Subscriber
return boolean