stomp

package
v0.0.0-...-5032e40 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConnected = errors.New("not connected")

Functions

This section is empty.

Types

type Client

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

Client is the Stomp conn wrapper.

func (*Client) Ack

func (c *Client) Ack(m *Message) error

Ack acknowledges a message received from the STOMP server.

func (*Client) Begin

func (c *Client) Begin() *Transaction

Begin is used to start a transaction.

func (*Client) BeginWithError

func (c *Client) BeginWithError(ctx context.Context) (*Transaction, error)

BeginWithError is used to start a transaction, but also returns the error.

func (*Client) Disconnect

func (c *Client) Disconnect() error

Disconnect will disconnect from the STOMP server.

func (*Client) Nack

func (c *Client) Nack(m *Message) error

Nack indicates to the server that a message was not received by the client.

func (*Client) Send

func (c *Client) Send(destination, contentType string, body []byte, opts *SendOptions) (err error)

Send sends a message to the STOMP server.

func (*Client) Server

func (c *Client) Server() string

Server returns the STOMP server identification.

func (*Client) Session

func (c *Client) Session() string

Session returns the session identifier.

func (*Client) Subscribe

func (c *Client) Subscribe(destination string, opts *SubscribeOptions) (*Subscription, error)

Subscribe creates a subscription on the STOMP server.

type Listener

type Listener func(*Message) error

Listener is a callback function to execute when the subscription reads a message

type ListenerError

type ListenerError func(goja.Value) (goja.Value, error)

type Message

type Message struct {
	*stomp.Message
	Subscription *Subscription
	// contains filtered or unexported fields
}

Message is a decorator to add string and json methods

func (*Message) JSON

func (m *Message) JSON(selector ...string) goja.Value

func (*Message) String

func (m *Message) String() string

type Options

type Options struct {
	Addr     string
	Protocol string
	Path     string
	Timeout  string
	TLS      bool
	Headers  map[string]string
	Host     string

	User string
	Pass string

	MessageSendTimeout string
	ReceiptTimeout     string

	Heartbeat struct {
		Incoming string
		Outgoing string
	}

	ReadBufferSize      int
	ReadChannelCapacity int

	WriteBufferSize      int
	WriteChannelCapacity int

	Verbose bool
}

type RootModule

type RootModule struct{}

func New

func New() *RootModule

func (*RootModule) NewModuleInstance

func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance

type SendOptions

type SendOptions struct {
	Headers         map[string]string
	Receipt         bool
	NoContentLength bool
}

type StatsReadWriteClose

type StatsReadWriteClose struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

func (*StatsReadWriteClose) Read

func (s *StatsReadWriteClose) Read(p []byte) (int, error)

func (*StatsReadWriteClose) Write

func (s *StatsReadWriteClose) Write(p []byte) (int, error)

type Stomp

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

Stomp is the k6 extension for a Stomp client.

func (*Stomp) Connect

func (s *Stomp) Connect(opts *Options) *Client

Connect to a stomp server

func (*Stomp) Exports

func (s *Stomp) Exports() modules.Exports

type SubscribeOptions

type SubscribeOptions struct {
	Ack      string
	Headers  map[string]string
	Id       string
	Listener Listener
	Error    ListenerError
}

type Subscription

type Subscription struct {
	*stomp.Subscription
	// contains filtered or unexported fields
}

func NewSubscription

func NewSubscription(client *Client, sc *stomp.Subscription, listener Listener, listenerError ListenerError) *Subscription

func (*Subscription) Continue

func (s *Subscription) Continue() error

func (*Subscription) Read

func (s *Subscription) Read() (msg *Message, err error)

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe(opts ...func(*frame.Frame) error) error

type Transaction

type Transaction struct {
	*stomp.Transaction
	// contains filtered or unexported fields
}

func (*Transaction) Ack

func (tx *Transaction) Ack(m *Message) error

func (*Transaction) Nack

func (tx *Transaction) Nack(m *Message) error

func (*Transaction) Send

func (tx *Transaction) Send(destination, contentType string, body []byte, opts *SendOptions) (err error)

type VerboseReadWriteClose

type VerboseReadWriteClose struct {
	io.ReadWriteCloser
}

func (*VerboseReadWriteClose) Read

func (v *VerboseReadWriteClose) Read(p []byte) (int, error)

func (*VerboseReadWriteClose) Write

func (v *VerboseReadWriteClose) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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