pulsartest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Addr     string
	Received <-chan frame.Frame
	// contains filtered or unexported fields
}

Server emulates a Pulsar server

func NewServer

func NewServer(ctx context.Context) (*Server, error)

NewServer returns a ready-to-use Pulsar test server. The server will be closed when the context is canceled.

func (*Server) AssertReceived

func (m *Server) AssertReceived(ctx context.Context, frameTypes ...api.BaseCommand_Type) error

AssertReceived accepts a list of message types. It then compares them to the frames it has received, and returns an error if they don't match or if the context times out. Note: The m.Received channel is buffered, so AssertReceived can be called from the main goroutine.

func (*Server) Broadcast

func (m *Server) Broadcast(f frame.Frame) error

Broadcast sends the given frame to all connected clients.

func (*Server) CloseAll

func (m *Server) CloseAll() error

CloseAll closes all connected client connections.

func (*Server) SetIgnoreConnects

func (m *Server) SetIgnoreConnects(ignore bool)

SetIgnoreConnects instructs the server to NOT respond to CONNECT requests if true.

func (*Server) SetIgnorePings

func (m *Server) SetIgnorePings(ignore bool)

SetIgnorePings instructs the server to NOT respond to PING requests if true.

func (*Server) SetTopicLookupResp

func (m *Server) SetTopicLookupResp(topic, serviceURL string, respType api.CommandLookupTopicResponse_LookupType, proxyThroughServiceURL bool)

SetTopicLookupResp updates the BrokerServiceURL returned for the given topic from LOOKUP requests. If not set, the server's Addr is used by default. If connect if false, the response type is REDIRECT.

func (*Server) TotalNumConns

func (m *Server) TotalNumConns() int

TotalNumConns returns the total number of connections (active or inactive) received by the Server.

Jump to

Keyboard shortcuts

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