NewRPCConnection creates a new [RPCConnection] to the target using the specified function that creates a new client.
(target string, newClientFunc func(cc grpc.ClientConnInterface) T, opts ...grpc.DialOption)
| 71 | |
| 72 | // NewRPCConnection creates a new [RPCConnection] to the target using the specified function that creates a new client. |
| 73 | func NewRPCConnection[T any](target string, newClientFunc func(cc grpc.ClientConnInterface) T, opts ...grpc.DialOption) *RPCConnection[T] { |
| 74 | conn := &RPCConnection[T]{ |
| 75 | Target: target, |
| 76 | Opts: opts, |
| 77 | } |
| 78 | conn.Client = newClientFunc(conn) |
| 79 | |
| 80 | return conn |
| 81 | } |
| 82 | |
| 83 | // ForceReconnect drops the established gRPC client conn and forces a re-connect at the next client call. |
| 84 | func (conn *RPCConnection[T]) ForceReconnect() { |
no outgoing calls