stomp: github.com/go-stomp/stomp/server/queue Index | Files

package queue

import "github.com/go-stomp/stomp/server/queue"

Package queue provides implementations of server-side queues.

Index

Package Files

manager.go memory_queue.go queue.go storage.go

type Manager Uses

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

Queue manager.

func NewManager Uses

func NewManager(qstore Storage) *Manager

Create a queue manager with the specified queue storage mechanism

func (*Manager) Find Uses

func (qm *Manager) Find(destination string) *Queue

Finds the queue for the given destination, and creates it if necessary.

type MemoryQueueStorage Uses

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

In-memory implementation of the QueueStorage interface.

func (*MemoryQueueStorage) Dequeue Uses

func (m *MemoryQueueStorage) Dequeue(queue string) (*frame.Frame, error)

Removes a frame from the head of the queue. Returns nil if no frame is available.

func (*MemoryQueueStorage) Enqueue Uses

func (m *MemoryQueueStorage) Enqueue(queue string, frame *frame.Frame) error

func (*MemoryQueueStorage) Requeue Uses

func (m *MemoryQueueStorage) Requeue(queue string, frame *frame.Frame) error

Pushes a frame to the head of the queue. Sets the "message-id" header of the frame if it is not already set.

func (*MemoryQueueStorage) Start Uses

func (m *MemoryQueueStorage) Start()

Called at server startup. Allows the queue storage to perform any initialization.

func (*MemoryQueueStorage) Stop Uses

func (m *MemoryQueueStorage) Stop()

Called prior to server shutdown. Allows the queue storage to perform any cleanup.

type Queue Uses

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

Queue for storing message frames.

func (*Queue) Enqueue Uses

func (q *Queue) Enqueue(f *frame.Frame) error

Send a message to the queue. If a subscription is available to receive the message, it is sent to the subscription without making it to the queue. Otherwise, the message is queued until a message is available.

func (*Queue) Requeue Uses

func (q *Queue) Requeue(f *frame.Frame) error

Send a message to the front of the queue, probably because it failed to be sent to a client. If a subscription is available to receive the message, it is sent to the subscription without making it to the queue. Otherwise, the message is queued until a message is available.

func (*Queue) Subscribe Uses

func (q *Queue) Subscribe(sub *client.Subscription) error

Add a subscription to a queue. The subscription is removed whenever a frame is sent to the subscription and needs to be re-added when the subscription decides that the message has been received by the client.

func (*Queue) Unsubscribe Uses

func (q *Queue) Unsubscribe(sub *client.Subscription)

Unsubscribe a subscription.

type Storage Uses

type Storage interface {
    // Pushes a MESSAGE frame to the end of the queue. Sets
    // the "message-id" header of the frame before adding to
    // the queue.
    Enqueue(queue string, frame *frame.Frame) error

    // Pushes a MESSAGE frame to the head of the queue. Sets
    // the "message-id" header of the frame if it is not
    // already set.
    Requeue(queue string, frame *frame.Frame) error

    // Removes a frame from the head of the queue.
    // Returns nil if no frame is available.
    Dequeue(queue string) (*frame.Frame, error)

    // Called at server startup. Allows the queue storage
    // to perform any initialization.
    Start()

    // Called prior to server shutdown. Allows the queue storage
    // to perform any cleanup.
    Stop()
}

Interface for queue storage. 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)

func NewMemoryQueueStorage Uses

func NewMemoryQueueStorage() Storage

Package queue imports 3 packages (graph) and is imported by 7 packages. Updated 2016-07-27. Refresh now. Tools for package owners.