Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] grpc client language error #7231

Closed
3 tasks done
weihubeats opened this issue Aug 22, 2023 · 2 comments
Closed
3 tasks done

[Bug] grpc client language error #7231

weihubeats opened this issue Aug 22, 2023 · 2 comments
Labels

Comments

@weihubeats
Copy link
Member

weihubeats commented Aug 22, 2023

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

Ubuntu 22.04.2 LTS

RocketMQ version

5.1.0

JDK Version

1.8

Describe the Bug

The current grpc method of access to the client to obtain the language are written in Java, the actual should be obtained from the ProxyContext

image

Steps to Reproduce

Sending messages using the go client

/*
 * 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.
 */

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"strconv"
	"time"

	rmq_client "github.com/apache/rocketmq-clients/golang"
	"github.com/apache/rocketmq-clients/golang/credentials"
)

const (
	Topic     = "xiao-zou-topic"
	Endpoint  = "127.0.0.1:8081"
	AccessKey = "xxxxxx"
	SecretKey = "xxxxxx"
)

func main() {
	os.Setenv("mq.consoleAppender.enabled", "true")
	rmq_client.ResetLogger()
	// new producer instance
	producer, err := rmq_client.NewProducer(&rmq_client.Config{
		Endpoint: Endpoint,
		Credentials: &credentials.SessionCredentials{
			AccessKey:    AccessKey,
			AccessSecret: SecretKey,
		},
	},
		rmq_client.WithTopics(Topic),
	)
	if err != nil {
		log.Fatal(err)
	}
	// start producer
	err = producer.Start()
	if err != nil {
		log.Fatal(err)
	}
	// graceful stop producer
	defer producer.GracefulStop()
	for i := 0; i < 10; i++ {
		go func() {
			for i := 0; i < 100; i++ {
				// new a message
				msg := &rmq_client.Message{
					Topic: Topic,
					Body:  []byte("xiaozou message : " + strconv.Itoa(i)),
				}
				// set keys and tag
				msg.SetKeys("a", "b")
				msg.SetTag("ab")
				// send message in sync
				resp, err := producer.Send(context.TODO(), msg)
				if err != nil {
					log.Fatal(err)
				}
				for i := 0; i < len(resp); i++ {
					fmt.Printf("%#v\n", resp[i])
				}
				// wait a moment
				time.Sleep(time.Second * 1)
			}
		}()
	}

	select {}

}

What Did You Expect to See?

The language the server gets is go

What Did You See Instead?

The language the server gets is java

Additional Context

No response

RongtongJin pushed a commit that referenced this issue Oct 20, 2023
* Adding null does not update

* add langeuga code

* add langeuga code

* add langeuga code

* add langeuga code

* add langeuga code

* Rerun ci

* Rerun ci

* Rerun ci

* remove redundant package imports

* redundant line

* modify the parameter passed as proxyContext to language

* format
Copy link

This issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 22, 2024
Copy link

This issue was closed because it has been inactive for 3 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant