File tree Expand file tree Collapse file tree 5 files changed +34
-6
lines changed Expand file tree Collapse file tree 5 files changed +34
-6
lines changed Original file line number Diff line number Diff line change
1
+ 2011-11-18 Sergey S. Sergeev
2
+
3
+ * main/Utils/AMQP/AMQPConsumer.class.php,
4
+ main/Utils/AMQP/AMQPDefaultConsumer.class.php,
5
+ main/Utils/AMQP/Pecl/AMQPPeclChannel.class.php:
6
+ handle change СonsumerTag implemented.
7
+
1
8
2011-11-18 Evgeny V. Kokovikhin
2
9
3
10
* main/Messages/TextMessage.class.php, main/Messages/TextFileReceiver.class.php:
Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ public function handleConsumeOk($consumerTag);
41
41
**/
42
42
public function handleCancelOk ($ consumerTag );
43
43
44
+ /**
45
+ * Called when the consumer is changed tag
46
+ *
47
+ * @param string $fromTag
48
+ * @param string $toTag
49
+ * @return void
50
+ **/
51
+ public function handleChangeConsumerTag ($ fromTag , $ toTag );
52
+
44
53
/**
45
54
* @return AMQPConsumer
46
55
**/
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ public function handleDelivery(AMQPIncomingMessage $delivery)
72
72
// no work to do
73
73
}
74
74
75
+ /**
76
+ * @return void
77
+ **/
78
+ public function handleChangeConsumerTag ($ fromTag , $ toTag )
79
+ {
80
+ // no work to do
81
+ }
82
+
75
83
/**
76
84
* @return AMQPDefaultConsumer
77
85
**/
Original file line number Diff line number Diff line change @@ -485,11 +485,12 @@ public function getNextDelivery()
485
485
}
486
486
487
487
$ this ->checkCommandResult (
488
- is_array ($ messages ),
488
+ is_array ($ messages ) && ! empty ( $ messages ) ,
489
489
"Could not consume from queue "
490
490
);
491
491
492
492
$ message = array_shift ($ messages );
493
+
493
494
$ incoming = AMQPIncomingMessage::spawn ($ message );
494
495
495
496
if ($ this ->consumer ->getConsumerTag () === null ) {
@@ -499,11 +500,9 @@ public function getNextDelivery()
499
500
$ this ->consumer ->getConsumerTag ()
500
501
!= $ incoming ->getConsumerTag ()
501
502
) {
502
- throw new WrongStateException (
503
- "Consumer change tag consumerTag= "
504
- ."{$ this ->consumer ->getConsumerTag ()}, "
505
- ."message.consumerTag= {$ incoming ->getConsumerTag ()}, "
506
- ."message.body= {$ incoming ->getBody ()}"
503
+ $ this ->consumer ->handleChangeConsumerTag (
504
+ $ this ->consumer ->getConsumerTag (),
505
+ $ incoming ->getConsumerTag ()
507
506
);
508
507
}
509
508
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ public function getCheckString()
32
32
{
33
33
return $ this ->checkString ;
34
34
}
35
+
36
+ public function handleChangeConsumerTag ($ fromTag , $ toTag )
37
+ {
38
+ return ;
39
+ }
35
40
}
36
41
37
42
class AMQPPeclTest extends TestCase
You can’t perform that action at this time.
0 commit comments