Documentation ¶
Index ¶
- Variables
- func HttpMultipartReq(opt *HttpClient_opt, httpclient *http.Client, parts []part) error
- func HttpReq(opt *HttpClient_opt, httpclient *http.Client, content_type string, ...) error
- func MapString(m map[string]string) string
- func OnNotifyAsync(notifier Notifier, factory *MarshalFactory) <-chan NotifierFuture
- func ValidNotifier(edge *channelv3.NotifierEdge_option) (err error)
- type ChannelConsole
- type ChannelRabbitMQ
- func (channel *ChannelRabbitMQ) Close()
- func (ChannelRabbitMQ) Dial(url string) (*amqp.Connection, *amqp.Channel, error)
- func (channel *ChannelRabbitMQ) OnNotify(factory *MarshalFactory) error
- func (channel ChannelRabbitMQ) Property() map[string]string
- func (ChannelRabbitMQ) Publish(opt *channelv2.RabbitMqConfig, ch *amqp.Channel, b []byte) error
- func (channel ChannelRabbitMQ) Type() fmt.Stringer
- func (channel ChannelRabbitMQ) Uuid() string
- type ChannelSlackhook
- type ChannelWebhook
- type Event
- func (pub Event) BuildChannelFormatter(channel_uuid string) (err error)
- func (pub *Event) BuildMuxerByChannelUuid(tenant_hash string, channel_uuid string) error
- func (pub *Event) BuildMuxerByEventCategory(tenant_hash string, event_category channelv3.EventCategory) (err error)
- func (pub *Event) Close()
- func (pub Event) InvokeByChannelUuid(tenant_hash string, channel_uuid string, v []map[string]interface{})
- func (pub Event) InvokeByEventCategory(tenant_hash string, ec channelv3.EventCategory, v []map[string]interface{})
- func (pub *Event) OnError(err error)
- func (pub *Event) OnNotifierError(notifier Notifier, err error)
- func (pub *Event) SetEventNotifierMuxer(mux EventNotifierMuxer)
- type EventNotifierMuxer
- type Formatter
- type Formatter_fields
- type Formatter_jq
- type HashsetErrorHandlers
- type HashsetFormatter
- type HashsetNofitierErrorHandler
- type HashsetNotifier
- type HttpClient_opt
- type ManagedEventNotifierMux
- func (mux *ManagedEventNotifierMux) Close()
- func (mux *ManagedEventNotifierMux) EventPublisher() Publisher
- func (mux ManagedEventNotifierMux) Formatters() HashsetFormatter
- func (mux ManagedEventNotifierMux) Notifiers() HashsetNotifier
- func (mux ManagedEventNotifierMux) OnNotify(v []map[string]interface{}) []error
- func (mux ManagedEventNotifierMux) OnNotifyAsync(v []map[string]interface{}) []<-chan NotifierFuture
- func (mux *ManagedEventNotifierMux) Regist(pub Publisher) EventNotifierMuxer
- func (mux *ManagedEventNotifierMux) Update(v []map[string]interface{})
- type MarshalFactory
- type Notifier
- type NotifierFuture
- type Publisher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultErrorHandler = func(err error) { var stack string logs.CauseIter(err, func(err error) { logs.StackIter(err, func(s string) { stack = logs.KVL( "stack", s, ) }) }) logger.Error(fmt.Errorf("%w%s", err, stack)) } DefaultErrorHandler_notifier = func(pub *Event) func(notifier Notifier, err error) { return func(notifier Notifier, err error) { defer func() { r := recover() if r == nil { return } if err, ok := r.(error); ok { pub.OnError(errors.Wrapf(err, "recover notifier error handler")) } else { pub.OnError(errors.Errorf("notifier error handler recover='%+v'", r)) } }() var stack string logs.CauseIter(err, func(err error) { logs.StackIter(err, func(s string) { stack = logs.KVL( "stack", s, ) }) }) uuid := notifier.Uuid() created := time.Now() message := fmt.Sprintf("%s%s", err.Error(), stack) if err_ := vault.CreateChannelStatus(pub.ctx, pub.DB, pub.dialect, uuid, message, created, globvar.Event.NofitierStatusRotateLimit()); err_ != nil { err_ = errors.Wrapf(err_, "failed to logging to channel status") pub.ErrorHandlers.OnError(err_) } } } )
View Source
var InvokeByChannelUuid func(tenant_hash string, channel_uuid string, v []map[string]interface{}) = func(tenant_hash string, channel_uuid string, v []map[string]interface{}) {}
View Source
var InvokeByEventCategory func(tenant_hash string, ec channelv3.EventCategory, v []map[string]interface{}) = func(tenant_hash string, ec channelv3.EventCategory, v []map[string]interface{}) {}
Functions ¶
func HttpMultipartReq ¶
func HttpMultipartReq(opt *HttpClient_opt, httpclient *http.Client, parts []part) error
func OnNotifyAsync ¶
func OnNotifyAsync(notifier Notifier, factory *MarshalFactory) <-chan NotifierFuture
func ValidNotifier ¶
func ValidNotifier(edge *channelv3.NotifierEdge_option) (err error)
Types ¶
type ChannelConsole ¶
type ChannelConsole struct {
// contains filtered or unexported fields
}
func NewChannelConsole ¶
func NewChannelConsole(uuid string, opt *channelv2.ConsoleConfig) *ChannelConsole
func (*ChannelConsole) Close ¶
func (channel *ChannelConsole) Close()
func (ChannelConsole) OnNotify ¶
func (channel ChannelConsole) OnNotify(factory *MarshalFactory) error
func (ChannelConsole) Property ¶
func (channel ChannelConsole) Property() map[string]string
func (ChannelConsole) Type ¶
func (channel ChannelConsole) Type() fmt.Stringer
func (ChannelConsole) Uuid ¶
func (channel ChannelConsole) Uuid() string
type ChannelRabbitMQ ¶
type ChannelRabbitMQ struct {
// contains filtered or unexported fields
}
func NewChannelRabbitMQ ¶
func NewChannelRabbitMQ(uuid string, opt *channelv2.RabbitMqConfig) *ChannelRabbitMQ
func (*ChannelRabbitMQ) Close ¶
func (channel *ChannelRabbitMQ) Close()
func (ChannelRabbitMQ) Dial ¶
func (ChannelRabbitMQ) Dial(url string) (*amqp.Connection, *amqp.Channel, error)
func (*ChannelRabbitMQ) OnNotify ¶
func (channel *ChannelRabbitMQ) OnNotify(factory *MarshalFactory) error
func (ChannelRabbitMQ) Property ¶
func (channel ChannelRabbitMQ) Property() map[string]string
func (ChannelRabbitMQ) Publish ¶
func (ChannelRabbitMQ) Publish(opt *channelv2.RabbitMqConfig, ch *amqp.Channel, b []byte) error
func (ChannelRabbitMQ) Type ¶
func (channel ChannelRabbitMQ) Type() fmt.Stringer
func (ChannelRabbitMQ) Uuid ¶
func (channel ChannelRabbitMQ) Uuid() string
type ChannelSlackhook ¶
type ChannelSlackhook struct {
// contains filtered or unexported fields
}
func NewChannelSlackhook ¶
func NewChannelSlackhook(uuid string, opt *channelv2.SlackhookConfig) *ChannelSlackhook
func (*ChannelSlackhook) Close ¶
func (channel *ChannelSlackhook) Close()
func (ChannelSlackhook) OnNotify ¶
func (channel ChannelSlackhook) OnNotify(factory *MarshalFactory) (err error)
func (ChannelSlackhook) Property ¶
func (channel ChannelSlackhook) Property() map[string]string
func (ChannelSlackhook) Type ¶
func (channel ChannelSlackhook) Type() fmt.Stringer
func (ChannelSlackhook) Uuid ¶
func (channel ChannelSlackhook) Uuid() string
type ChannelWebhook ¶
type ChannelWebhook struct {
// contains filtered or unexported fields
}
func NewChannelWebhook ¶
func NewChannelWebhook(uuid string, opt *channelv2.WebhookConfig) *ChannelWebhook
func (*ChannelWebhook) Close ¶
func (channel *ChannelWebhook) Close()
func (ChannelWebhook) OnNotify ¶
func (channel ChannelWebhook) OnNotify(factory *MarshalFactory) error
func (ChannelWebhook) Property ¶
func (channel ChannelWebhook) Property() map[string]string
func (ChannelWebhook) Type ¶
func (channel ChannelWebhook) Type() fmt.Stringer
func (ChannelWebhook) Uuid ¶
func (channel ChannelWebhook) Uuid() string
type Event ¶
type Event struct { *sql.DB // HashsetEventNotifierMuxer EventNotifierMuxer ErrorHandlers HashsetErrorHandlers NofitierErrorHandlers HashsetNofitierErrorHandler // contains filtered or unexported fields }
func (Event) BuildChannelFormatter ¶
func (*Event) BuildMuxerByChannelUuid ¶
func (*Event) BuildMuxerByEventCategory ¶
func (pub *Event) BuildMuxerByEventCategory(tenant_hash string, event_category channelv3.EventCategory) (err error)
func (Event) InvokeByChannelUuid ¶
func (Event) InvokeByEventCategory ¶
func (pub Event) InvokeByEventCategory(tenant_hash string, ec channelv3.EventCategory, v []map[string]interface{})
func (*Event) OnNotifierError ¶
func (*Event) SetEventNotifierMuxer ¶
func (pub *Event) SetEventNotifierMuxer(mux EventNotifierMuxer)
type EventNotifierMuxer ¶
type EventNotifierMuxer interface { Notifiers() HashsetNotifier // Notifiers Formatters() HashsetFormatter // Formatter Update([]map[string]interface{}) // Update 발생 EventPublisher() Publisher Regist(Publisher) EventNotifierMuxer Close() // 이벤트 구독 취소 // 전체 Notifier 제거 }
EventNotifierMuxer
type Formatter ¶
type Formatter interface { Format(map[string]interface{}) (interface{}, error) Type() channelv2.FormatType }
type Formatter_fields ¶
type Formatter_fields struct { FormatData string sync.Once // contains filtered or unexported fields }
func (*Formatter_fields) Format ¶
func (format *Formatter_fields) Format(a map[string]interface{}) (interface{}, error)
func (Formatter_fields) Type ¶
func (format Formatter_fields) Type() channelv2.FormatType
type Formatter_jq ¶
func (*Formatter_jq) Format ¶
func (format *Formatter_jq) Format(a map[string]interface{}) (interface{}, error)
func (Formatter_jq) Type ¶
func (format Formatter_jq) Type() channelv2.FormatType
type HashsetErrorHandlers ¶
func (HashsetErrorHandlers) Add ¶
func (hashset HashsetErrorHandlers) Add(fn ...func(error)) HashsetErrorHandlers
func (HashsetErrorHandlers) OnError ¶
func (hashset HashsetErrorHandlers) OnError(err error)
func (HashsetErrorHandlers) Remove ¶
func (hashset HashsetErrorHandlers) Remove(fn ...func(error)) HashsetErrorHandlers
type HashsetFormatter ¶
func (HashsetFormatter) Add ¶
func (hashset HashsetFormatter) Add(channel_uuid string, formatter Formatter)
func (HashsetFormatter) Remove ¶
func (hashset HashsetFormatter) Remove(channel_uuid string)
type HashsetNofitierErrorHandler ¶
func (HashsetNofitierErrorHandler) Add ¶
func (hashset HashsetNofitierErrorHandler) Add(fn ...func(Notifier, error)) HashsetNofitierErrorHandler
func (HashsetNofitierErrorHandler) OnError ¶
func (hashset HashsetNofitierErrorHandler) OnError(notifier Notifier, err error)
func (HashsetNofitierErrorHandler) Remove ¶
func (hashset HashsetNofitierErrorHandler) Remove(fn ...func(error)) HashsetNofitierErrorHandler
type HashsetNotifier ¶
func (HashsetNotifier) Add ¶
func (hashset HashsetNotifier) Add(channel_uuid string, notifier Notifier)
func (HashsetNotifier) Remove ¶
func (hashset HashsetNotifier) Remove(channel_uuid string)
type HttpClient_opt ¶
type ManagedEventNotifierMux ¶
type ManagedEventNotifierMux struct {
// contains filtered or unexported fields
}
func NewManagedEventNotifierMux ¶
func NewManagedEventNotifierMux() *ManagedEventNotifierMux
func (*ManagedEventNotifierMux) Close ¶
func (mux *ManagedEventNotifierMux) Close()
func (*ManagedEventNotifierMux) EventPublisher ¶
func (mux *ManagedEventNotifierMux) EventPublisher() Publisher
func (ManagedEventNotifierMux) Formatters ¶
func (mux ManagedEventNotifierMux) Formatters() HashsetFormatter
func (ManagedEventNotifierMux) Notifiers ¶
func (mux ManagedEventNotifierMux) Notifiers() HashsetNotifier
func (ManagedEventNotifierMux) OnNotify ¶
func (mux ManagedEventNotifierMux) OnNotify(v []map[string]interface{}) []error
func (ManagedEventNotifierMux) OnNotifyAsync ¶
func (mux ManagedEventNotifierMux) OnNotifyAsync(v []map[string]interface{}) []<-chan NotifierFuture
func (*ManagedEventNotifierMux) Regist ¶
func (mux *ManagedEventNotifierMux) Regist(pub Publisher) EventNotifierMuxer
func (*ManagedEventNotifierMux) Update ¶
func (mux *ManagedEventNotifierMux) Update(v []map[string]interface{})
type MarshalFactory ¶
type MarshalFactory struct { Value map[string]interface{} Formatter Formatter // contains filtered or unexported fields }
func NewMarshalFactory ¶
func NewMarshalFactory(v map[string]interface{}, format Formatter) *MarshalFactory
type Notifier ¶
type Notifier interface { Type() fmt.Stringer //리스너 타입 Uuid() string //uuid Property() map[string]string //요약 // PropertyString() string //요약 OnNotify(*MarshalFactory) error //알림 발생 Close() //리스너 종료 }
Notifier
func NotifierFactory ¶
func NotifierFactory(uuid string, mc *channelv3.NotifierEdge_option) (notifier Notifier, err error)
type NotifierFuture ¶
Click to show internal directories.
Click to hide internal directories.