publisher send schema

This commit is contained in:
chrislu
2024-04-12 23:36:15 -07:00
parent 8415476c2d
commit 68ade92d4f
3 changed files with 15 additions and 0 deletions

View File

@@ -2,8 +2,10 @@ package pub_client
import (
"fmt"
"github.com/golang/protobuf/proto"
"github.com/seaweedfs/seaweedfs/weed/mq/pub_balancer"
"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/schema_pb"
"github.com/seaweedfs/seaweedfs/weed/util"
"time"
)
@@ -25,6 +27,16 @@ func (p *TopicPublisher) Publish(key, value []byte) error {
})
}
func (p *TopicPublisher) PublishRecord(key []byte, recordValue *schema_pb.RecordValue) error {
// serialize record value
value, err := proto.Marshal(recordValue)
if err != nil {
return fmt.Errorf("failed to marshal record value: %v", err)
}
return p.Publish(key, value)
}
func (p *TopicPublisher) FinishPublish() error {
if inputBuffers, found := p.partition2Buffer.AllIntersections(0, pub_balancer.MaxPartitionCount); found {
for _, inputBuffer := range inputBuffers {