-
-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the subscription broadcast job queue to be configured (#1301)
- Loading branch information
1 parent
16803df
commit f67d908
Showing
9 changed files
with
96 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Nuwave\Lighthouse\Subscriptions; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Queue\SerializesModels; | ||
use Nuwave\Lighthouse\Schema\Types\GraphQLSubscription; | ||
use Nuwave\Lighthouse\Subscriptions\Contracts\BroadcastsSubscriptions; | ||
|
||
class BroadcastSubscriptionJob implements ShouldQueue | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
/** | ||
* The subscription field that was requested. | ||
* | ||
* @var \Nuwave\Lighthouse\Schema\Types\GraphQLSubscription | ||
*/ | ||
public $subscription; | ||
|
||
/** | ||
* The name of the field. | ||
* | ||
* @var string | ||
*/ | ||
public $fieldName; | ||
|
||
/** | ||
* The root element to be passed when resolving the subscription. | ||
*/ | ||
public $root; | ||
|
||
public function __construct(GraphQLSubscription $subscription, string $fieldName, $root) | ||
{ | ||
$this->subscription = $subscription; | ||
$this->fieldName = $fieldName; | ||
$this->root = $root; | ||
} | ||
|
||
public function handle(BroadcastsSubscriptions $broadcaster): void | ||
{ | ||
$broadcaster->broadcast($this->subscription, $this->fieldName, $this->root); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters