Kubemq-go missing tags in response to query via GRPC

2/26/2020

I am developing a microservices interacting via kubemq in cluster. When sending query response (via GRPC protocol) with some tags attached:

    err := client.NewResponse().
                    SetRequestId(query.Id).
                    SetResponseTo(query.ResponseTo).
                    SetExecutedAt(time.Now()).
                    SetMetadata("this is a response").
                    SetBody([]byte("got your query, you are good to go")).
                    SetTags(map[string]string{"key0":"val0","key1":"val1"}).
                    Send(ctx)

I descovered I do not see them at the receiver response:

    response, err := client.NewQuery().
        SetId("some-query-id").
        SetChannel(channel).
        SetMetadata("some-metadata").
        SetBody([]byte("hello kubemq - sending a query, please reply")).
        SetTimeout(1 *time.Second).
        Send(ctx)
    fmt.Println("Response Tags Received:",response.Tags)

Output shows:

Response Tags Received: map[]

So response.Tags is empty. Then I took a look at the official query example https://github.com/kubemq-io/kubemq-go/blob/master/examples/rpc/query/main.go. Note it is using rest protocol

    client, err := kubemq.NewClient(ctx,
        kubemq.WithUri("http://localhost:9090"),
        kubemq.WithClientId("test-query-client-id"),
        kubemq.WithTransportType(kubemq.TransportTypeRest))

After I did add some tags to the query response (as shown in the first code in this post) it was showing tags in the response properly, but when I did switch protocol to grpc:

        kubemq.WithAddress("localhost", 50000),
    //  kubemq.WithUri("http://localhost:9090"),
        kubemq.WithClientId("test-query-client-id"),
        kubemq.WithTransportType(kubemq.TransportTypeGRPC))
    //  kubemq.WithTransportType(kubemq.TransportTypeRest))

It start to stop showing tags in the response.

I did some updated kubemqgo examples here https://github.com/Aidamir/kubemq-go/tree/master/examples/rpc Illustrating this issue. There is 2 directories query-tags-rest, query-tags-grpc and also query is the official query example which I was using as a source. There is only a few modifications for the client protocol. Please explain me, why tags are not sending when using grpc? May be there is some protocol restrictions which I was missing from documentation?

-- Testobile Testossimo
grpc-go
kubernetes
message-queue
microservices

1 Answer

2/27/2020

It was a bug, I posted an issue https://github.com/kubemq-io/kubemq-go/issues/7 and it was fixed fastly. You must update to version 1.3.3 to avoid this problem.

-- Testobile Testossimo
Source: StackOverflow