connect

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpConnectionResolver

type HttpConnectionResolver struct {
	//The base connection resolver.
	ConnectionResolver ccon.ConnectionResolver
	//The base credential resolver.
	CredentialResolver cauth.CredentialResolver
}

HttpConnectionResolver helper class to retrieve connections for HTTP-based services abd clients.

In addition to regular functions of ConnectionResolver is able to parse http:// URIs and validate connection parameters before returning them.

Configuration parameters:

  • connection:

  • discovery_key: (optional) a key to retrieve the connection from IDiscovery

  • ... other connection parameters

  • connections: alternative to connection

  • [connection params 1]: first connection parameters

  • ...

  • [connection params N]: Nth connection parameters

  • ...

    References:

- *:discovery:*:*:1.0 (optional) IDiscovery services

See: ConnectionParams See: ConnectionResolver

Example:

    config := cconf.NewConfigParamsFromTuples(
         "connection.host", "10.1.1.100",
         "connection.port", 8080,
    );

    connectionResolver = NewHttpConnectionResolver();
    connectionResolver.Configure(config);
    connectionResolver.SetReferences(references);

    connection, err := connectionResolver.Resolve("123")
	// Now use connection...

func NewHttpConnectionResolver

func NewHttpConnectionResolver() *HttpConnectionResolver

NewHttpConnectionResolver creates new instance NewHttpConnectionResolver Returns pointer on NewHttpConnectionResolver

func (*HttpConnectionResolver) Configure

func (c *HttpConnectionResolver) Configure(config *cconf.ConfigParams)

Configure method are configures component by passing configuration parameters. Parameters:

  • config *cconf.ConfigParams configuration parameters to be set.

func (*HttpConnectionResolver) Register

func (c *HttpConnectionResolver) Register(correlationId string) error

func (*HttpConnectionResolver) Resolve

func (c *HttpConnectionResolver) Resolve(correlationId string) (connection *ccon.ConnectionParams, credential *cauth.CredentialParams, err error)

Resolve method are resolves a single component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there. Parameters: - correlationId string (optional) transaction id to trace execution through call chain. Returns: connection *ccon.ConnectionParams, credential *cauth.CredentialParams, err error resolved connection and credential or error.

func (*HttpConnectionResolver) ResolveAll

func (c *HttpConnectionResolver) ResolveAll(correlationId string) (connections []*ccon.ConnectionParams, credential *cauth.CredentialParams, err error)

ResolveAll method are resolves all component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there. Parameters: - correlationId string (optional) transaction id to trace execution through call chain. Returns: connections []*ccon.ConnectionParams, credential *cauth.CredentialParams, err error resolved connections and credential or error.

func (*HttpConnectionResolver) SetReferences

func (c *HttpConnectionResolver) SetReferences(references crefer.IReferences)

SetReferences method are sets references to dependent components. Parameters:

  • references crefer.IReferences references to locate the component dependencies.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL