httpq

package module
v0.0.0-...-b61e704 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2015 License: MIT Imports: 7 Imported by: 1

README

httpq

With Httpq, you can buffer HTTP requests and replay them later, and persistence can be either to Redis or to disk. This is useful for buffering HTTP requests that do not have to be processed in realtime, such as webhooks.

Installation

$ go install github.com/DavidHuie/httpq/cmd/httpq

Using Redis

$ httpq -redis=true -redis_url=":6379"

Using disk persistence

$ httpq -db_path="/tmp/httpq.db"

Queuing a request

$ curl localhost:3000/push

Replaying a request

$ curl localhost:3000/pop

GET /push HTTP/1.1
Host: localhost:3000
Accept: */*
User-Agent: curl/7.37.1

Determining size of queue

The result is returning as JSON.

$ curl localhost:3000/size

{"size":3}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Httpq

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

func NewHttpq

func NewHttpq(q Queue, debug bool) *Httpq

func (*Httpq) PopRequest

func (h *Httpq) PopRequest() (*http.Request, error)

func (*Httpq) PopRequestBytes

func (h *Httpq) PopRequestBytes() ([]byte, error)

func (*Httpq) PushRequest

func (h *Httpq) PushRequest(r *http.Request) error

func (*Httpq) Size

func (h *Httpq) Size() (uint64, error)

type Queue

type Queue interface {
	Push([]byte) error
	Pop() ([]byte, error)
	Size() (uint64, error)
}

type Server

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

func NewServer

func NewServer(httpq *Httpq) *Server

func (*Server) Pop

func (s *Server) Pop(w http.ResponseWriter, r *http.Request)

func (*Server) Push

func (s *Server) Push(w http.ResponseWriter, r *http.Request)

func (*Server) Size

func (s *Server) Size(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Godeps
_workspace/src/github.com/boltdb/bolt
Package bolt implements a low-level key/value store in pure Go.
Package bolt implements a low-level key/value store in pure Go.
_workspace/src/github.com/garyburd/redigo/internal/redistest
Package redistest contains utilities for writing Redigo tests.
Package redistest contains utilities for writing Redigo tests.
_workspace/src/github.com/garyburd/redigo/redis
Package redis is a client for the Redis database.
Package redis is a client for the Redis database.
cmd
queue

Jump to

Keyboard shortcuts

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