Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit faf6f2d

Browse files
committed
TASK: Implement Connection::QueueSubscribe
1 parent 068082e commit faf6f2d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/Connection.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,25 @@ public function subscribe($subject, \Closure $callback)
300300
return $sid;
301301
}
302302

303+
/**
304+
* Subscribes to an specific event given a subject and a queue.
305+
*
306+
* @param string $subject Message topic.
307+
* @param string $queue Queue name.
308+
* @param \Closure $callback Closure to be executed as callback.
309+
*
310+
* @return string
311+
*/
312+
public function queueSubscribe($subject, $queue, \Closure $callback)
313+
{
314+
$sid = uniqid();
315+
$msg = 'SUB '.$subject.' '.$queue.' '. $sid;
316+
$this->send($msg);
317+
$this->subscriptions[$sid] = $callback;
318+
319+
return $sid;
320+
}
321+
303322
/**
304323
* Unsubscribe from a event given a subject.
305324
*

0 commit comments

Comments
 (0)