aboutsummaryrefslogtreecommitdiff
path: root/weed/messaging/msgclient/publisher.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-05-10 23:45:48 -0700
committerChris Lu <chris.lu@gmail.com>2020-05-10 23:45:48 -0700
commitd5a8297a1cfeaa296cb160a6195ca9e14230048c (patch)
tree40684eccc4decd1493462ac427ab80a69359b6ae /weed/messaging/msgclient/publisher.go
parentd58371c5cd0cd7bbfd43516e2f6bbefe013aaa68 (diff)
downloadseaweedfs-d5a8297a1cfeaa296cb160a6195ca9e14230048c.tar.xz
seaweedfs-d5a8297a1cfeaa296cb160a6195ca9e14230048c.zip
able to connect publisher
Diffstat (limited to 'weed/messaging/msgclient/publisher.go')
-rw-r--r--weed/messaging/msgclient/publisher.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/weed/messaging/msgclient/publisher.go b/weed/messaging/msgclient/publisher.go
index ebb6d3f2a..b0fc5afbf 100644
--- a/weed/messaging/msgclient/publisher.go
+++ b/weed/messaging/msgclient/publisher.go
@@ -17,7 +17,6 @@ type Publisher struct {
publisherId string
}
-/*
func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*Publisher, error) {
// read topic configuration
topicConfiguration := &messaging_pb.TopicConfiguration{
@@ -25,11 +24,16 @@ func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*
}
publishClients := make([]messaging_pb.SeaweedMessaging_PublishClient, topicConfiguration.PartitionCount)
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
- client, err := setupPublisherClient(broker.TopicPartition{
+ tp := broker.TopicPartition{
Namespace: namespace,
Topic: topic,
Partition: int32(i),
- })
+ }
+ grpcClientConn, err := mc.findBroker(tp)
+ if err != nil {
+ return nil, err
+ }
+ client, err := setupPublisherClient(grpcClientConn, tp)
if err != nil {
return nil, err
}
@@ -40,7 +44,6 @@ func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*
topicConfiguration: topicConfiguration,
}, nil
}
-*/
func setupPublisherClient(grpcConnection *grpc.ClientConn, tp broker.TopicPartition) (messaging_pb.SeaweedMessaging_PublishClient, error) {
@@ -113,9 +116,3 @@ func (p *Publisher) Publish(m *messaging_pb.Message) error {
Data: m,
})
}
-
-func (p *Publisher) Shutdown() {
- for _, client := range p.publishClients {
- client.CloseSend()
- }
-}