Documentation ¶
Overview ¶
Package server contains a simple STOMP server implementation.
Index ¶
Constants ¶
const ( // Default address for listening for connections. DefaultAddr = ":61613" // Default read timeout for heart-beat. // Override by setting Server.HeartBeat. DefaultHeartBeat = time.Minute )
Default server parameters.
const QueuePrefix = "/queue"
The STOMP server has the concept of queues and topics. A message sent to a queue destination will be transmitted to the next available client that has subscribed. A message sent to a topic will be transmitted to all subscribers that are currently subscribed to the topic.
Destinations that start with this prefix are considered to be queues. Destinations that do not start with this prefix are considered to be topics.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
ListenAndServe listens on the TCP network address addr and then calls Serve.
Types ¶
type Authenticator ¶
type Authenticator interface { // Authenticate based on the given login and passcode, either of which might be nil. // Returns true if authentication is successful, false otherwise. Authenticate(login, passcode string) bool }
Interface for authenticating STOMP clients.
type QueueStorage ¶
type QueueStorage interface { // Enqueue adds a MESSAGE frame to the end of the queue. Enqueue(queue string, frame *frame.Frame) error // Requeue adds a MESSAGE frame to the head of the queue. // This will happen if a client fails to acknowledge receipt. Requeue(queue string, frame *frame.Frame) error // Dequeue removes a frame from the head of the queue. // Returns nil if no frame is available. Dequeue(queue string) (*frame.Frame, error) // Start is called at server startup. Allows the queue storage // to perform any initialization. Start() // Stop is called prior to server shutdown. Allows the queue storage // to perform any cleanup, such as flushing to disk. Stop() }
QueueStorage is an interface that abstracts the queue storage mechanism. The intent is that different queue storage implementations can be used, depending on preference. Queue storage mechanisms could include in-memory, and various persistent storage mechanisms (eg file system, DB, etc).
type Server ¶
type Server struct { Addr string // TCP address to listen on, DefaultAddr if empty Authenticator Authenticator // Authenticates login/passcodes. If nil no authentication is performed QueueStorage QueueStorage // Implementation of queue storage. If nil, in-memory queues are used. HeartBeat time.Duration // Preferred value for heart-beat read/write timeout, if zero, then DefaultHeartBeat. }
A Server defines parameters for running a STOMP server.
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address s.Addr and then calls Serve to handle requests on the incoming connections. If s.Addr is blank, then DefaultAddr is used.
Directories ¶
Path | Synopsis |
---|---|
Package client implements client connectivity in the STOMP server.
|
Package client implements client connectivity in the STOMP server. |
Package queue provides implementations of server-side queues.
|
Package queue provides implementations of server-side queues. |
Package topic provides implementations of server-side topics.
|
Package topic provides implementations of server-side topics. |