Documentation
¶
Index ¶
- Constants
- Variables
- func CreateHandler(logsDirPath string, namespaces []string) (http.Handler, error)
- func MatchSubject(subject, pattern string) bool
- func NewServer(addr string, logsDirPath string, namespaces []string) (*http.Server, error)
- func ValidateSubject(subject string) error
- func WithData(data any) *dataOpt
- func WithSubject(subject string) subjectOpt
- func WithTraceId(traceId string) *traceIdOpt
- type AckOpt
- type Acker
- type Client
- type Event
- type GetOpt
- type GetOptFunc
- type Getter
- type Handler
- type PutOpt
- type PutOptFunc
- type Putter
- type Response
Constants ¶
View Source
const ( AckManual = "manual" // client should ack the event AckNone = "none" // no need to ack and server push the event to the client as fast as possible )
View Source
const ( StartOldest = "oldest" StartNewest = "newest" )
View Source
const ( DefaultAck = AckNone DefaultStart = StartNewest DefaultRedelivery = 5 * time.Second )
View Source
const ( HeaderEventId = "X-BUS-EVENT-ID" HeaderEventCreatedAt = "X-BUS-EVENT-CREATED-AT" HeaderEventIndex = "X-BUS-EVENT-INDEX" HeaderConsumerId = "X-BUS-CONSUMER-ID" )
View Source
const (
DefaultSsePingTimeout = 30 * time.Second
)
Variables ¶
View Source
var ( Version = "dev" GitCommit = "" )
Functions ¶
func CreateHandler ¶ added in v0.3.5
func MatchSubject ¶ added in v0.3.0
MatchSubject checks if the given subject matches the pattern. it has been optimized for performance and zero allocations.
func ValidateSubject ¶ added in v0.3.0
func WithSubject ¶
func WithSubject(subject string) subjectOpt
WithSubject sets the subject of the event and consumer
func WithTraceId ¶ added in v0.3.4
func WithTraceId(traceId string) *traceIdOpt
Types ¶
type AckOpt ¶ added in v0.3.0
type AckOpt interface {
// contains filtered or unexported methods
}
AckOpt is an interface that can be used to configure the Ack operation
type Client ¶ added in v0.3.0
type Client struct {
// contains filtered or unexported fields
}
type Event ¶
type Event struct { Id string `json:"id"` TraceId string `json:"trace_id,omitempty"` Subject string `json:"subject"` ResponseSubject string `json:"response_subject,omitempty"` Payload json.RawMessage `json:"payload"` CreatedAt time.Time `json:"created_at"` Index int64 `json:"index"` // contains filtered or unexported fields }
type GetOpt ¶ added in v0.2.0
type GetOpt interface {
// contains filtered or unexported methods
}
GetOpt is an interface that can be used to configure the Get operation
func WithAckStrategy ¶ added in v0.3.0
func WithDelivery ¶ added in v0.3.0
func WithExtractMeta ¶ added in v0.3.0
func WithStartFrom ¶ added in v0.3.0
type GetOptFunc ¶ added in v0.3.0
type GetOptFunc func(*getOpt) error
type Handler ¶ added in v0.3.0
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶ added in v0.3.0
func (*Handler) Ack ¶ added in v0.3.0
func (h *Handler) Ack(w http.ResponseWriter, r *http.Request)
PUT /?consumer_id=c_123&event_id=e_456
type PutOpt ¶ added in v0.2.0
type PutOpt interface {
// contains filtered or unexported methods
}
func WithConfirm ¶
func WithRequestReply ¶ added in v0.3.0
func WithRequestReply() PutOpt
type PutOptFunc ¶ added in v0.3.0
type PutOptFunc func(*putOpt) error
Click to show internal directories.
Click to hide internal directories.