Skip to content

Commit

Permalink
fix: add streaming call
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta committed Jan 3, 2024
1 parent 2512bab commit c810d8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Topic/Internal/ScsTopicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ class ScsTopicClient implements LoggerAwareInterface
private TopicGrpcManager $grpcManager;
private LoggerInterface $logger;
private int $timeout;
private $authToken;

public function __construct(IConfiguration $configuration, ICredentialProvider $authProvider)
{
$authToken = $authProvider->getAuthToken();
$operationTimeoutMs = $configuration
->getTransportStrategy()
->getGrpcConfig()
Expand Down Expand Up @@ -146,11 +148,15 @@ public function subscribe(string $cacheName, string $topicName, callable $onMess

try {
validateCacheName($cacheName);

$authToken = $this->authToken;


$request = new _SubscriptionRequest();
$request->setCacheName($cacheName);
$request->setTopic($topicName);

$call = $this->grpcManager->client->Subscribe($request);
$call = $this->grpcManager->client->Subscribe($request, ['authorization' => ['Bearer ' . $authToken]]);
$this->processStreamingCall($call);

foreach ($call->responses() as $response) {
Expand Down

0 comments on commit c810d8f

Please sign in to comment.