Pulsar GoClient中与unacked_messages_timeout_ms(py-client)等效的部分是什么?

huangapple go评论93阅读模式
英文:

Pulsar GoClient Equivalent of unacked_messages_timeout_ms (py-client)

问题

在Pulsar Go Client中,没有与Python客户端中的unacked_messages_timeout_ms选项完全等效的选项。但是,你可以通过设置ConsumerOptions.NackRedeliveryDelay来配置重新传递的间隔时间。这个选项表示在消息未确认时,经过多长时间后重新传递消息。默认情况下,重新传递延迟是5秒。

以下是在Pulsar Go Client中设置重新传递间隔的示例代码:

go_consumer, err := client.Subscribe(pulsar.ConsumerOptions{
    Topic:            "my-topic",
    SubscriptionName: "go-subscriber",
    Type:             pulsar.Shared,
    NackRedeliveryDelay: 10000 * time.Millisecond,
})

请注意,NackRedeliveryDelay的值是以毫秒为单位的。在上面的示例中,重新传递间隔被设置为10秒。

希望这可以帮助到你!如果你有任何其他问题,请随时问我。

英文:

In Pulsar Python Client, there is subscriber option unacked_messages_timeout_ms to set the interval after which the unacked messages will be redelivered.

What is the equivalent of that in Pulsar Go Client ?

Python

py_consumer = client.subscribe(
    topic='my-topic',
    subscription_name="py-subscriber",
    unacked_messages_timeout_ms=10000,
    consumer_type=pulsar.ConsumerType.Shared
    )

Golang

go_consumer, err := client.Subscribe(
    pulsar.ConsumerOptions{
    Topic: "my-topic",
    SubscriptionName: "go-subscriber",
    Type: pulsar.Shared,
    unacked_messages_timeout_ms ????
})

I could not find anything here: https://pkg.go.dev/github.com/apache/pulsar-client-go/pulsar#ConsumerOptions

if it s not there, how to configure the re-delivery interval and what is the default value ?

Same question asked in Github Issues too: https://github.com/apache/pulsar-client-go/issues/608

答案1

得分: 2

"未确认消息超时"是一种过时的功能,很久以前引入的。

最近,我们添加了"负确认"的概念,以便为应用程序提供一种处理消息处理失败的简便方法。

由于Go客户端是在负确认已经可用的情况下编写的,所以我们决定不在其中引入这个过时的功能。

英文:

The "unacked messages timeout" is kind of a deprecated feature that was introduced long time ago.

More recently we have added the concept of "negative acks" to provide the application an easy way to handle failure in the processing of a message.

Since the Go client was written when negative acks were already available, we decided to not introduce the deprecated feature in there.

huangapple
  • 本文由 发表于 2021年9月1日 03:59:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/69004692.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定