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.
 
 
 
 
 
 

36 lines
943 B

package sub_client
import (
"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
type SubscriberConfiguration struct {
ConsumerGroup string
ConsumerId string
}
type TopicSubscriber struct {
config *SubscriberConfiguration
namespace string
topic string
brokerPartitionAssignments []*mq_pb.BrokerPartitionAssignment
grpcDialOption grpc.DialOption
}
func NewTopicSubscriber(config *SubscriberConfiguration, namespace, topic string) *TopicSubscriber {
return &TopicSubscriber{
config: config,
namespace: namespace,
topic: topic,
grpcDialOption: grpc.WithTransportCredentials(insecure.NewCredentials()),
}
}
func (sub *TopicSubscriber) Connect(bootstrapBroker string) error {
if err := sub.doLookup(bootstrapBroker); err != nil {
return err
}
return nil
}