Documentation
¶
Index ¶
- type Cache
- type Client
- func (c *Client) ClientConnection() grpc.ClientConnInterface
- func (c *Client) Close()
- func (c *Client) ConfiguredDialMinConnectTimeoutSeconds() uint
- func (c *Client) ConfiguredForClientDial() bool
- func (c *Client) ConfiguredForSNSDiscoveryTopicArn() bool
- func (c *Client) ConfiguredSNSDiscoveryTopicArn() string
- func (c *Client) Dial(ctx context.Context) error
- func (c *Client) GetState() connectivity.State
- func (c *Client) HealthProbe(serviceName string, timeoutDuration ...time.Duration) (grpc_health_v1.HealthCheckResponse_ServingStatus, error)
- func (c *Client) PreloadConfigData() error
- func (c *Client) RemoteAddress() string
- type WebServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
ServiceEndpoints map[string][]*serviceEndpoint
// contains filtered or unexported fields
}
func (*Cache) AddServiceEndpoints ¶
AddServiceEndpoints will append slice of service endpoints associated with the given serviceName within map
func (*Cache) GetLiveServiceEndpoints ¶
func (c *Cache) GetLiveServiceEndpoints(serviceName string, version string) (liveEndpoints []*serviceEndpoint)
GetLiveServiceEndpoints will retrieve currently non-expired service endpoints and remove any expired service endpoints from map, for a given serviceName
func (*Cache) PurgeServiceEndpoints ¶
PurgeServiceEndpoints will remove all endpoints associated with the given serviceName within map
type Client ¶
type Client struct {
// client properties
AppName string
ConfigFileName string
CustomConfigPath string
// web server config
WebServerConfig *WebServerConfig
// indicate if after dial, client will wait for target service health probe success before continuing to allow rpc
WaitForServerReady bool
// one or more unary client interceptors for handling wrapping actions
UnaryClientInterceptors []grpc.UnaryClientInterceptor
// one or more stream client interceptors for handling wrapping actions
StreamClientInterceptors []grpc.StreamClientInterceptor
// typically wrapper action to handle monitoring
StatsHandler stats.Handler
// handler to invoke before gRPC client dial is to start
BeforeClientDial func(cli *Client)
// handler to invoke after gRPC client dial performed
AfterClientDial func(cli *Client)
// handler to invoke before gRPC client connection is to close
BeforeClientClose func(cli *Client)
// handler to invoke after gRPC client connection has closed
AfterClientClose func(cli *Client)
// *** Setup by Dial Action ***
// helper for creating metadata context,
// and evaluate metadata header or trailer value when received from rpc
MetadataHelper *metadata.MetaClient
// contains filtered or unexported fields
}
Client represents a gRPC client's connection and entry point
note:
Using Compressor with RPC a) import "google.golang.org/grpc/encoding/gzip" b) in RPC Call, pass grpc.UseCompressor(gzip.Name)) in the third parameter example: RPCCall(ctx, &pb.Request{...}, grpc.UseCompressor(gzip.Name))
Notifier Client yaml a) xyz-notifier-client.yaml where xyz is the target gRPC service endpoint name
func (*Client) ClientConnection ¶
func (c *Client) ClientConnection() grpc.ClientConnInterface
ClientConnection returns the currently loaded grpc client connection
func (*Client) ConfiguredDialMinConnectTimeoutSeconds ¶ added in v1.0.7
ConfiguredDialMinConnectTimeoutSeconds gets the timeout seconds from config yaml
func (*Client) ConfiguredForClientDial ¶ added in v1.0.7
ConfiguredForClientDial checks if the config yaml is ready for client dial operation
func (*Client) ConfiguredForSNSDiscoveryTopicArn ¶ added in v1.0.7
ConfiguredForSNSDiscoveryTopicArn indicates if the sns topic arn for service discovery is configured within the config yaml
func (*Client) ConfiguredSNSDiscoveryTopicArn ¶ added in v1.0.7
ConfiguredSNSDiscoveryTopicArn returns the sns discovery topic arn as configured in config yaml
func (*Client) GetState ¶
func (c *Client) GetState() connectivity.State
GetState returns the current grpc client connection's state
func (*Client) HealthProbe ¶
func (c *Client) HealthProbe(serviceName string, timeoutDuration ...time.Duration) (grpc_health_v1.HealthCheckResponse_ServingStatus, error)
HealthProbe manually checks service serving health status
func (*Client) PreloadConfigData ¶ added in v1.0.7
PreloadConfigData will load the config data before Dial()
func (*Client) RemoteAddress ¶
RemoteAddress gets the remote endpoint address currently connected to
type WebServerConfig ¶ added in v1.0.7
type WebServerConfig struct {
AppName string
ConfigFileName string
CustomConfigPath string
// define web server router info
WebServerRoutes map[string]*ginw.RouteDefinition
// getter only
WebServerLocalAddress string
}
note: WebServerLocalAddress = read only getter
note: WebServerRoutes = map[string]*ginw.RouteDefinition{
"base": {
Routes: []*ginw.Route{
{
Method: ginhttpmethod.GET,
RelativePath: "/",
Handler: func(c *gin.Context, bindingInputPtr interface{}) {
c.String(200, "Connector Client Http Host Up")
},
},
},
},
}