Skip to content

Commit 4c960f3

Browse files
committed
[client] add needReply argument
1 parent 95cd03b commit 4c960f3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎pkg/enqueue/Client/ProducerV2.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function sendEvent($topic, $message)
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
public function sendCommand($command, $message)
41+
public function sendCommand($command, $message, $needReply = false)
4242
{
4343
if (false == $message instanceof Message) {
4444
$message = new Message($message);
@@ -48,9 +48,10 @@ public function sendCommand($command, $message)
4848
$message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $command);
4949
$message->setScope(Message::SCOPE_APP);
5050

51-
if ($message->getReplyTo()) {
51+
if ($needReply) {
5252
return $this->rpcClient->callAsync(Config::COMMAND_TOPIC, $message, 60);
5353
}
54+
5455
$this->realProducer->send(Config::COMMAND_TOPIC, $message);
5556
}
5657
}

‎pkg/enqueue/Client/ProducerV2Interface.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function sendEvent($topic, $message);
1919
* @param string $command
2020
* @param string|array|Message $message
2121
*
22-
* @return Promise|null the promise is returned if message has reply to set
22+
* @return Promise|null the promise is returned if needReply argument is true
2323
*/
2424
public function sendCommand($command, $message);
2525
}

0 commit comments

Comments
 (0)