Documentation ¶
Index ¶
- Constants
- Variables
- func Error(w http.ResponseWriter, code int, err error, msg string)
- func JSON(w http.ResponseWriter, code int, src interface{})
- func PrintDebugf(format string, args ...interface{})
- func Respond(w http.ResponseWriter, code int, src interface{})
- func Routes() *router.Router
- type CLI
- type Config
- type ErrorResponse
- type Monitoring
- func (m *Monitoring) SubscriptionDetail(w http.ResponseWriter, r *http.Request, id string)
- func (m *Monitoring) SubscriptionSummary(w http.ResponseWriter, r *http.Request)
- func (m *Monitoring) Summary(w http.ResponseWriter, r *http.Request)
- func (m *Monitoring) TopicDetail(w http.ResponseWriter, r *http.Request, id string)
- func (m *Monitoring) TopicSummary(w http.ResponseWriter, r *http.Request)
- type PublishData
- type PublishDatas
- type PushConfig
- type RequestAck
- type RequestModifyAck
- type RequestModifyPush
- type RequestPull
- type ResourceSubscription
- type ResponseListSubscription
- type ResponsePublish
- type ResponsePull
- type Server
- type SubscriptionServer
- func (s *SubscriptionServer) Ack(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) Create(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) Delete(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) Get(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) List(w http.ResponseWriter, r *http.Request)
- func (s *SubscriptionServer) ModifyAck(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) ModifyPush(w http.ResponseWriter, r *http.Request, id string)
- func (s *SubscriptionServer) Pull(w http.ResponseWriter, r *http.Request, id string)
- type TopicServer
- func (s *TopicServer) Create(w http.ResponseWriter, r *http.Request, id string)
- func (s *TopicServer) Delete(w http.ResponseWriter, r *http.Request, id string)
- func (s *TopicServer) Get(w http.ResponseWriter, r *http.Request, id string)
- func (s *TopicServer) List(w http.ResponseWriter, r *http.Request)
- func (s *TopicServer) ListSubscription(w http.ResponseWriter, r *http.Request, id string)
- func (s *TopicServer) Publish(w http.ResponseWriter, r *http.Request, id string)
Constants ¶
const ( ExitCodeOK = 0 // Specific error codes. begin 10- ExitCodeError = 10 + iota ExitCodeParseError ExitCodeInvalidArgsError ExitCodeSetupServerError )
Exit codes. used only in Run()
Variables ¶
var ( // ErrParseFailed is failed to cli args parse ErrParseFailed = errors.New("failed to parse args") )
Functions ¶
func Error ¶
func Error(w http.ResponseWriter, code int, err error, msg string)
Error is wrapped Respond when error response
func JSON ¶
func JSON(w http.ResponseWriter, code int, src interface{})
JSON is wrapped Respond when success response
func PrintDebugf ¶
func PrintDebugf(format string, args ...interface{})
PrintDebugf behaves like log.Printf only in the debug env
func Respond ¶
func Respond(w http.ResponseWriter, code int, src interface{})
Respond is response write to ResponseWriter
Types ¶
type Config ¶
Config represent yaml config
func LoadConfigFromFile ¶
LoadConfigFromFile read config file and create config object
type ErrorResponse ¶
ErrorResponse is Error response template
func (*ErrorResponse) String ¶
func (e *ErrorResponse) String() string
type Monitoring ¶
type Monitoring struct{}
Monitoring is monitoring frontend server
func (*Monitoring) SubscriptionDetail ¶
func (m *Monitoring) SubscriptionDetail(w http.ResponseWriter, r *http.Request, id string)
SubscriptionDetail returns detail from subscription stats
func (*Monitoring) SubscriptionSummary ¶
func (m *Monitoring) SubscriptionSummary(w http.ResponseWriter, r *http.Request)
SubscriptionSummary returns summary from subscription stats
func (*Monitoring) Summary ¶
func (m *Monitoring) Summary(w http.ResponseWriter, r *http.Request)
Summary returns summary from all stats
func (*Monitoring) TopicDetail ¶
func (m *Monitoring) TopicDetail(w http.ResponseWriter, r *http.Request, id string)
TopicDetail returns detail from topic stats
func (*Monitoring) TopicSummary ¶
func (m *Monitoring) TopicSummary(w http.ResponseWriter, r *http.Request)
TopicSummary returns summary from topic stats
type PublishData ¶
PublishData represent post publish data
type PublishDatas ¶
type PublishDatas struct {
Messages []PublishData `json:"messages"`
}
PublishDatas represent PublishData group
type PushConfig ¶
type PushConfig struct { Endpoint string `json:"endpoint"` Attr map[string]string `json:"attributes"` }
PushConfig represent parmeter of push message
type RequestAck ¶
type RequestAck struct {
AckIDs []string `json:"ack_ids"`
}
RequestAck represent request ack API json
type RequestModifyAck ¶
type RequestModifyAck struct { AckIDs []string `json:"ack_ids"` AckDeadlineSeconds int64 `json:"ack_deadline_seconds"` }
RequestModifyAck represent request ModifyAck API json
type RequestModifyPush ¶
type RequestModifyPush struct {
PushConfig *PushConfig `json:"push_config"`
}
RequestModifyPush represent request ModifyPush API json
type RequestPull ¶
type RequestPull struct { // TODO: ReturnImmediately bool MaxMessages int `json:"max_messages"` }
RequestPull is represents request json for Pull
type ResourceSubscription ¶
type ResourceSubscription struct { Name string `json:"name"` Topic string `json:"topic"` Push PushConfig `json:"push_config"` AckTimeout int64 `json:"ack_deadline_seconds"` }
ResourceSubscription represent create subscription request and response data
type ResponseListSubscription ¶
type ResponseListSubscription struct {
SubscriptionNames []string `json:"subscriptions"`
}
ResponseListSubscription represent response json of ListSubscription
type ResponsePublish ¶
type ResponsePublish struct {
MessageIDs []string `json:"message_ids"`
}
ResponsePublish represent reponse publish api
type ResponsePull ¶
type ResponsePull struct {
Messages []*models.PullMessage `json:"receive_messages"`
}
ResponsePull is represents response json for Pull
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is topic and subscription frontend server
func (*Server) InitDatastore ¶
InitDatastore prepare datastore initialize
func (*Server) PrepareServer ¶
PrepareServer settings datastore and stats configuration
type SubscriptionServer ¶
type SubscriptionServer struct{}
SubscriptionServer is subscription frontend server
func (*SubscriptionServer) Ack ¶
func (s *SubscriptionServer) Ack(w http.ResponseWriter, r *http.Request, id string)
Ack is setting ack state
func (*SubscriptionServer) Create ¶
func (s *SubscriptionServer) Create(w http.ResponseWriter, r *http.Request, id string)
Create is create subscription
func (*SubscriptionServer) Delete ¶
func (s *SubscriptionServer) Delete(w http.ResponseWriter, r *http.Request, id string)
Delete is delete subscription
func (*SubscriptionServer) Get ¶
func (s *SubscriptionServer) Get(w http.ResponseWriter, r *http.Request, id string)
Get is get already exist subscription
func (*SubscriptionServer) List ¶
func (s *SubscriptionServer) List(w http.ResponseWriter, r *http.Request)
List is gets subscription list
func (*SubscriptionServer) ModifyAck ¶
func (s *SubscriptionServer) ModifyAck(w http.ResponseWriter, r *http.Request, id string)
ModifyAck is ack timeout setting already delivered message
func (*SubscriptionServer) ModifyPush ¶
func (s *SubscriptionServer) ModifyPush(w http.ResponseWriter, r *http.Request, id string)
ModifyPush is modify push parameters
func (*SubscriptionServer) Pull ¶
func (s *SubscriptionServer) Pull(w http.ResponseWriter, r *http.Request, id string)
Pull is get some messages
type TopicServer ¶
type TopicServer struct{}
TopicServer is topic frontend server
func (*TopicServer) Create ¶
func (s *TopicServer) Create(w http.ResponseWriter, r *http.Request, id string)
Create is create topic
func (*TopicServer) Delete ¶
func (s *TopicServer) Delete(w http.ResponseWriter, r *http.Request, id string)
Delete is delete topic
func (*TopicServer) Get ¶
func (s *TopicServer) Get(w http.ResponseWriter, r *http.Request, id string)
Get is get already exist topic
func (*TopicServer) List ¶
func (s *TopicServer) List(w http.ResponseWriter, r *http.Request)
List is gets topic list
func (*TopicServer) ListSubscription ¶
func (s *TopicServer) ListSubscription(w http.ResponseWriter, r *http.Request, id string)
ListSubscription is gets topic depends subscription list
func (*TopicServer) Publish ¶
func (s *TopicServer) Publish(w http.ResponseWriter, r *http.Request, id string)
Publish is publish message