Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Unable to list more than 100 topics #231

Closed
marcinbudny opened this issue May 30, 2021 · 1 comment · Fixed by #234
Closed

Unable to list more than 100 topics #231

marcinbudny opened this issue May 30, 2021 · 1 comment · Fixed by #234

Comments

@marcinbudny
Copy link

Hi, I have trouble listing all the topics in my SB namespace.

Azure Service Bus Go version: v0.10.12

When the namespace contains more than 100 topics, func (*TopicManager) List returns only first 100 of them. There is no way to increase the page size or get subsequent pages. I think the same problem occurs for queues and subscriptions.

Sample repro:

package main

import (
	"context"
	"fmt"

	servicebus "github.com/Azure/azure-service-bus-go"
)

func main() {
	ns, _ := servicebus.NewNamespace(servicebus.NamespaceWithConnectionString("[CONN STRING HERE]"))
	topicManager := ns.NewTopicManager()

	topicsCreated := 0
	for i := 1; i <= 120; i++ {

		topicManager := ns.NewTopicManager()
		_, err := topicManager.Put(context.Background(), fmt.Sprintf("t%d", i))
		if err == nil {
			topicsCreated += 1
		}
	}

	fmt.Printf("Topics created: %d\n", topicsCreated)

	topics, _ := topicManager.List(context.Background())
	fmt.Printf("Topics listed: %d\n", len(topics))
}

Outputs:

Topics created: 120
Topics listed: 100
richardpark-msft added a commit that referenced this issue Jul 13, 2021
…riptions, queues and topics #234

The current implementation that lists resources (using ATOM) doesn't allow passing in skip, which would allow you to list more than the default page size of 100 items.

This PR adds in skip (and top, which controls the size of the page) for listing queues, topics and subscriptions which allows you, over multiple calls and incrementing skip, to get the list of all entities.

Fixes #231
@richardpark-msft
Copy link
Member

Hi @marcinbudny, sorry it took so long to fix this. I added in the ability to specify a page (and a count) via optional skip and top parameters. Look at the changes around List() to specify them.

Release: https://github.com/Azure/azure-service-bus-go/releases/tag/v0.10.14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants