-
Notifications
You must be signed in to change notification settings - Fork 10
/
event_handler_builder.go
32 lines (26 loc) · 1.06 KB
/
event_handler_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package kafka_wrapper
import (
"github.com/Trendyol/kafka-wrapper/execution_behaviour"
"github.com/Trendyol/kafka-wrapper/params"
)
type EventHandlerBuilder interface {
AddBehavioralSelectors(topics params.TopicsParameters, selector execution_behaviour.BehavioralSelector) EventHandlerBuilder
Build() map[string]execution_behaviour.BehavioralSelector
}
type eventHandlerBuilder struct {
behavioralSelectors map[string]execution_behaviour.BehavioralSelector
}
func NewEventHandlerBuilder() EventHandlerBuilder {
return &eventHandlerBuilder{
behavioralSelectors: make(map[string]execution_behaviour.BehavioralSelector),
}
}
func (e *eventHandlerBuilder) AddBehavioralSelectors(topics params.TopicsParameters, selector execution_behaviour.BehavioralSelector) EventHandlerBuilder {
e.behavioralSelectors[topics.Topic] = selector
e.behavioralSelectors[topics.RetryTopic] = selector
e.behavioralSelectors[topics.ErrorTopic] = selector
return e
}
func (e *eventHandlerBuilder) Build() map[string]execution_behaviour.BehavioralSelector {
return e.behavioralSelectors
}