client

package module
v0.0.0-...-cefaf62 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

Client library for Agent Communication API.

Documentation

Overview

Package client is an AgentCommunication client library.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DebugLogging enables debug logging.
	DebugLogging = false
	// ErrConnectionClosed is an error indicating that the connection was closed by the caller.
	ErrConnectionClosed = errors.New("connection closed")
	// ErrMessageTimeout is an error indicating message send timed out.
	ErrMessageTimeout = errors.New("timed out waiting for response")
	// ErrResourceExhausted is an error indicating that the server responded to the send with
	// ResourceExhausted.
	ErrResourceExhausted = errors.New("resource exhausted")
)

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection is an AgentCommunication connection.

func CreateConnection

func CreateConnection(ctx context.Context, channelID string, regional bool, opts ...option.ClientOption) (*Connection, error)

CreateConnection creates a new connection.

func (*Connection) Close

func (c *Connection) Close()

Close the connection.

func (*Connection) Receive

func (c *Connection) Receive() (*acpb.MessageBody, error)

Receive messages.

func (*Connection) SendMessage

func (c *Connection) SendMessage(msg *acpb.MessageBody) error

SendMessage sends a message to the client. Will automatically retry on message timeout (temporary disconnects) and in the case of ResourceExhausted with a backoff. Because retries are limited the returned error can in some cases be one of ErrMessageTimeout or ErrResourceExhausted, in which case send should be retried by the caller.

Directories

Path Synopsis
Example usage of the ACS client library.
Example usage of the ACS client library.
Package agentcommunication is an auto-generated package for the Agent Communication API.
Package agentcommunication is an auto-generated package for the Agent Communication API.
agentcommunicationpb
Code generated by protoc-gen-go.
Code generated by protoc-gen-go.

Jump to

Keyboard shortcuts

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