@@ -21,8 +21,8 @@ Reference [PulsarApi.proto](src/PulsarApi.proto) And support Swoole coroutine
2121## Requirements
2222
2323* PHP >=7.0 (Supported PHP8)
24- * ZLib Extension(If you want to use zlib compression)
25- * Zstd Extension(If you want to use zstd compression)
24+ * ZLib Extension(If you want to use ` zlib ` compression)
25+ * Zstd Extension(If you want to use ` zstd ` compression)
2626* Swoole Extension(If you want to use in swoole)
2727 * Use in the swoole only requires that the ` SWOOLE_HOOK_SOCKETS、SWOOLE_HOOK_STREAM_FUNCTION ` or ` SWOOLE_HOOK_ALL `
2828
@@ -61,10 +61,12 @@ $producer = new Producer('pulsar://localhost:6650', $options);
6161$producer->connect();
6262
6363for ($i = 0; $i < 10; $i++) {
64- $messageID = $producer->send(sprintf('hello %d',$i),[
64+ $messageID = $producer->send(sprintf('hello %d',$i));
65+
66+ $messageID = $producer->send(sprintf('hello properties %d',$i),[
6567 MessageOptions::PROPERTIES => [
66- 'key' => 'value',
67- 'ms' => microtime(true),
68+ 'key' => 'value',
69+ 'ms' => microtime(true),
6870 ]
6971 ]);
7072 echo 'messageID ' . $messageID . "\n";
@@ -142,13 +144,17 @@ $consumer->connect();
142144
143145while (true) {
144146 $message = $consumer->receive();
145- echo sprintf('Got message 【%s】messageID[%s] topic[%s] publishTime[%s]',
147+
148+ // get properties
149+ var_export($message->getProperties());
150+
151+ echo sprintf('Got message 【%s】messageID[%s] topic[%s] publishTime[%s]',
146152 $message->getPayload(),
147153 $message->getMessageId(),
148154 $message->getTopic(),
149155 $message->getPublishTime()
150156 ) . "\n";
151-
157+
152158 // ...
153159
154160 // Remember to confirm that the message is complete after processing
0 commit comments