Skip to content

Commit dd65b8e

Browse files
committed
Add basic consume methods.
1 parent 154cc82 commit dd65b8e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/AmqpContext.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,34 @@ public function unbind(AmqpBind $bind);
5757
* @param bool $global
5858
*/
5959
public function setQos($prefetchSize, $prefetchCount, $global);
60+
61+
/**
62+
* Notify broker that the channel is interested in consuming messages from this queue.
63+
*
64+
* A callback function to which the consumed message will be passed.
65+
* The function must accept at a minimum one parameter, an \Interop\Amqp\AmqpMessage object,
66+
* and an optional second parameter the \Interop\Amqp\AmqpConsumer from which the message was
67+
* consumed. The \Interop\Amqp\AmqpContext::basicConsume() will not return the processing thread back to
68+
* the PHP script until the callback function returns FALSE.
69+
*
70+
* @param AmqpConsumer $consumer
71+
* @param callable $callback
72+
*
73+
* @return void
74+
*/
75+
public function subscribe(AmqpConsumer $consumer, callable $callback);
76+
77+
/**
78+
* @param AmqpConsumer $consumer
79+
*
80+
* @return void
81+
*/
82+
public function unsubscribe(AmqpConsumer $consumer);
83+
84+
/**
85+
* @param float|int $timeout milliseconds, consumes endlessly if zero set
86+
*
87+
* @return void
88+
*/
89+
public function consume($timeout = 0);
6090
}

0 commit comments

Comments
 (0)