mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-03 18:19:04 +08:00
29 lines
838 B
Go
29 lines
838 B
Go
|
package broker
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/seaweedfs/seaweedfs/weed/mq/topic"
|
||
|
"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
|
||
|
)
|
||
|
|
||
|
func (b *MessageQueueBroker) ClosePublishers(ctx context.Context, request *mq_pb.ClosePublishersRequest) (resp *mq_pb.ClosePublishersResponse, err error) {
|
||
|
resp = &mq_pb.ClosePublishersResponse{}
|
||
|
|
||
|
t := topic.FromPbTopic(request.Topic)
|
||
|
|
||
|
b.localTopicManager.ClosePublishers(t, request.UnixTimeNs)
|
||
|
|
||
|
// wait until all publishers are closed
|
||
|
b.localTopicManager.WaitUntilNoPublishers(t)
|
||
|
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (b *MessageQueueBroker) CloseSubscribers(ctx context.Context, request *mq_pb.CloseSubscribersRequest) (resp *mq_pb.CloseSubscribersResponse, err error) {
|
||
|
resp = &mq_pb.CloseSubscribersResponse{}
|
||
|
|
||
|
b.localTopicManager.CloseSubscribers(topic.FromPbTopic(request.Topic), request.UnixTimeNs)
|
||
|
|
||
|
return
|
||
|
}
|