modify
This commit is contained in:
@@ -92,7 +92,9 @@ class OnPipeMessage extends Callback
|
||||
{
|
||||
[$topic, $rdMessage] = $message['body'];
|
||||
|
||||
call_user_func($message['handler'], new Struct($topic, $rdMessage));
|
||||
$message['handler'][0]->setParams(new Struct($topic, $rdMessage));
|
||||
|
||||
call_user_func($message['handler']);
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
@@ -12,11 +12,14 @@ interface ConsumerInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param Struct $struct
|
||||
* @return mixed
|
||||
*/
|
||||
public function onHandler(Struct $struct): void;
|
||||
/**
|
||||
* @param Struct $struct
|
||||
* @return mixed
|
||||
*/
|
||||
public function onHandler(Struct $struct): void;
|
||||
|
||||
|
||||
public function setParams(...$params): void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ class Kafka extends \Snowflake\Process\Process
|
||||
if (empty($handler)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = swoole_serialize(['action' => 'kafka', 'handler' => $handler, 'body' => [$topic, $message]]);
|
||||
|
||||
$server->sendMessage($message, random_int(0, $setting - 1));
|
||||
|
||||
Reference in New Issue
Block a user