You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							34 lines
						
					
					
						
							888 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							34 lines
						
					
					
						
							888 B
						
					
					
				| package sub_client | |
| 
 | |
| import ( | |
| 	"context" | |
| 	"fmt" | |
| 	"github.com/seaweedfs/seaweedfs/weed/pb" | |
| 	"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb" | |
| ) | |
| 
 | |
| func (sub *TopicSubscriber) doLookup(brokerAddress string) error { | |
| 	err := pb.WithBrokerGrpcClient(true, | |
| 		brokerAddress, | |
| 		sub.SubscriberConfig.GrpcDialOption, | |
| 		func(client mq_pb.SeaweedMessagingClient) error { | |
| 			lookupResp, err := client.LookupTopicBrokers(context.Background(), | |
| 				&mq_pb.LookupTopicBrokersRequest{ | |
| 					Topic: &mq_pb.Topic{ | |
| 						Namespace: sub.ContentConfig.Namespace, | |
| 						Name:      sub.ContentConfig.Topic, | |
| 					}, | |
| 					IsForPublish: false, | |
| 				}) | |
| 			if err != nil { | |
| 				return err | |
| 			} | |
| 			sub.brokerPartitionAssignments = lookupResp.BrokerPartitionAssignments | |
| 			return nil | |
| 		}) | |
| 
 | |
| 	if err != nil { | |
| 		return fmt.Errorf("lookup topic %s/%s: %v", sub.ContentConfig.Namespace, sub.ContentConfig.Topic, err) | |
| 	} | |
| 	return nil | |
| }
 |