Skip to content

How to get MaxOffset #1202

@jxs1211

Description

@jxs1211

Hi, I want to implement a rocketmq scaler in KEDA, which is intended to get the Lag by calculating the offset in the mq, but I don't find any exported API in the SDK for getting maxOffset, then I find this issue #1167 , and I found this API meet our need:

consumer/consumer.go
1000:func (dc *defaultConsumer) queryMaxOffset(mq *primitive.MessageQueue) (int64, error) {
1001-	brokerAddr := dc.client.GetNameSrv().FindBrokerAddrByName(mq.BrokerName)
1002-	if brokerAddr == "" {
1003-		dc.client.GetNameSrv().UpdateTopicRouteInfo(mq.Topic)
1004-		brokerAddr = dc.client.GetNameSrv().FindBrokerAddrByName(mq.BrokerName)
1005-	}

and I want to know is it ok to add API for getting maxOffset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions