client

package
v0.0.0-...-a9154ef Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Submit

func Submit(ctx context.Context, pub Publisher, req *agentv1.JobRequest, traceID, senderID string, key *ecdsa.PrivateKey) error

Submit is a convenience function for submitting a job without creating a Client instance.

Types

type Client

type Client struct {
	NATS       *nats.Conn
	PublicKeys map[string]*ecdsa.PublicKey
}

Client is a CAP client.

func (*Client) Submit

func (c *Client) Submit(ctx context.Context, req *agentv1.JobRequest, traceID, senderID string, key *ecdsa.PrivateKey) error

Submit publishes a JobRequest to the submit subject.

func (*Client) Subscribe

func (c *Client) Subscribe(subject string, handler Handler) (*nats.Subscription, error)

Subscribe subscribes to a subject and handles incoming packets.

type Handler

type Handler func(context.Context, *agentv1.BusPacket)

Handler processes a received BusPacket.

type Publisher

type Publisher interface {
	Publish(subject string, data []byte) error
}

Publisher is an interface that can publish a message to a subject.

Jump to

Keyboard shortcuts

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