|
|
@ -2,12 +2,14 @@ package agent_client |
|
|
|
|
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"crypto/tls" |
|
|
|
"fmt" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/mq/schema" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/mq_agent_pb" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/schema_pb" |
|
|
|
"google.golang.org/grpc" |
|
|
|
"google.golang.org/grpc/credentials" |
|
|
|
) |
|
|
|
|
|
|
|
type PublishSession struct { |
|
|
@ -21,7 +23,7 @@ type PublishSession struct { |
|
|
|
func NewPublishSession(agentAddress string, topicSchema *schema.Schema, partitionCount int, publisherName string) (*PublishSession, error) { |
|
|
|
|
|
|
|
// call local agent grpc server to create a new session
|
|
|
|
clientConn, err := pb.GrpcDial(context.Background(), agentAddress, true, grpc.WithInsecure()) |
|
|
|
clientConn, err := pb.GrpcDial(context.Background(), agentAddress, true, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{}))) |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("dial agent server %s: %v", agentAddress, err) |
|
|
|
} |
|
|
|