You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/09 10:08:11 UTC

[GitHub] [rocketmq-clients] bendan365 commented on a diff in pull request #278: Implement native php client #255

bendan365 commented on code in PR #278:
URL: https://github.com/apache/rocketmq-clients/pull/278#discussion_r1044288127


##########
php/Producer.php:
##########
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache\Rocketmq;
+
+require 'vendor/autoload.php';
+
+
+use Apache\Rocketmq\V2\MessageQueue;
+use Apache\Rocketmq\V2\MessagingServiceClient;
+use Apache\Rocketmq\V2\QueryRouteRequest;
+use Apache\Rocketmq\V2\ReceiveMessageRequest;
+use Apache\Rocketmq\V2\Resource;
+use Grpc\ChannelCredentials;
+use const Grpc\STATUS_OK;
+
+class Producer
+{
+
+    public function init()
+    {
+        // 客户端ID 因为目前我的主机名称是中文的,害怕解析会有问题,所以暂时先将主机名称写死

Review Comment:
   'update_metadata' => function ($metaData) use ($clientId) {
               $metaData['headers'] = ['clientID' => $clientId]; // Pass the ClientID to the server through the header 
               return $metaData;
           }
   but the response data is 
   {"message":"\n\u001f\b\u0478\u0002\u0012\u0019client id cannot be empty","status":{"metadata":[],"code":0,"details":""},"metadata":[]}
   
   
   $metaData['headers'] = ['x-mq-client-id' => $clientId];
   the response data is the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org