-
Notifications
You must be signed in to change notification settings - Fork 21
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
Check version when serverProperties is not empty and < 3.11.0 #345
Conversation
and is less than 3.11 Signed-off-by: Gabriele Santomaggio <[email protected]>
and is less than 3.11 Signed-off-by: Gabriele Santomaggio <[email protected]>
@LucasZhanye can you please try this PR? |
Yes, I can I try it later, and I will reply it after I finished |
@Gsantomaggio I try it, it is work well! And I want to know how long it will release a new version for it ? |
oh, I find another problem. Now I can DeclareStream,NewProducer,but producer.Send is not take effect. my code is :
But the rabbitmq management show as below: the queue message is zero,but I send 6002 |
@LucasZhanye, I cannot reproduce the issue. ![]() You should check the server logs and also try to remove these values: SetMaxSegmentSizeBytes(stream.ByteCapacity{}.MB(1)).
SetMaxLengthBytes(stream.ByteCapacity{}.MB(2))) also you should always enable the confirmation and wait before close the producer since the send is async producerOptions := stream.NewProducerOptions()
producerOptions.SetProducerName("producer")
// Batch 100 Events in the same Frame, and the SDK will handle everything
// DEDPULICATION DOES NOT WORK WITH SUBENTRY
producerOptions.SetSubEntrySize(100)
producerOptions.SetCompression(stream.Compression{}.Gzip())
producer, err := env.NewProducer(EVENTSTREAM, producerOptions)
if err != nil {
panic(err)
}
chPublishConfirm := producer.NotifyPublishConfirmation()
totalConfirmed := int32(0)
chFinished := make(chan struct{})
go func() {
for confirmed := range chPublishConfirm {
for _, msg := range confirmed {
if msg.IsConfirmed() {
atomic.AddInt32(&totalConfirmed, 1)
if atomic.LoadInt32(&totalConfirmed) == 6001 {
chFinished <- struct{}{}
}
} else {
fmt.Printf("message %s failed \n ", msg.GetMessage().GetData())
}
}
}
}()
// Publish 6001 messages
for i := 0; i <= 6001; i++ {
// fmt.Println("i = ", i)
event := Event{
Name: "test",
}
data, err := json.Marshal(event)
if err != nil {
panic(err)
}
message := amqp.NewMessage(data)
// Apply properties to our message
props := &amqp.MessageProperties{
CorrelationID: uuid.NewString(),
}
message.Properties = props
// Set Publishing ID to prevent Deduplication
message.SetPublishingId(int64(i))
// Sending the message
if err := producer.Send(message); err != nil {
panic(err)
}
}
<-chFinished
producer.Close()
env.Close()
fmt.Printf("Closed with total Confirmed: %d\n", totalConfirmed) |
Thanks so much! Now I run main.go on local system, but the rabbitmq server is on remote, I have a problem when NewProducer, the log is: "panic: Authentication Failure" But I run main.go on the remote system which the rabbitmq server on , it runs ok. |
The debug log is:
|
I think it is clear where is the problem here |
Signed-off-by: Gabriele Santomaggio <[email protected]>
In my opinion, the problem of connecting to pre-3.11 servers is solved, as confirmed above. If there are no other technical problems, I think it is mergeable |
Hi @Gsantomaggio Maybe I know why it is the queue is zero. Because I have two rabbitmq server run by docker container, the first is listen on 5552, and the second is listen on 15552 When I exec main.go which is connect to the port 15552, it will send msg to the rabbitmq server which is listen on 5552. From the log, at last it use 5552:
Finally, I see the rabbitmq management which is listen on 5552 , the queue message is increased. |
@hiimjako @LucasZhanye merged. |
I find the solution on #315 I change my code to below:
It works ok! |
Fixes: #344
When the
serverProperties["version"]
is not empty the client now checks the version.If the version is >=3.11 it is possible to enable the
exchangeVersion
function.Fixes another small bug when the single active consumer is enabled
cc @hiimjako