Skip to content

Commit 547652e

Browse files
committed
Update base_trigger.go
1 parent 1c1f101 commit 547652e

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

pkg/capabilities/base_trigger.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,26 @@ type BaseTriggerCapability struct {
5858
wg sync.WaitGroup
5959
}
6060

61-
func (b *BaseTriggerCapability) SetSend(fn OutboundSend) { b.send = fn }
62-
func (b *BaseTriggerCapability) SetLostHook(h LostHook) { b.lost = h }
63-
func (b *BaseTriggerCapability) SetStore(s EventStore) { b.store = s }
64-
func (b *BaseTriggerCapability) SetTiming(retry, max time.Duration) {
65-
b.tRetransmit = retry
66-
b.tMax = max
61+
func NewBaseTriggerCapability(
62+
store EventStore,
63+
send OutboundSend,
64+
lost LostHook,
65+
lggr logger.Logger,
66+
tRetransmit, tMax time.Duration,
67+
) *BaseTriggerCapability {
68+
ctx, cancel := context.WithCancel(context.Background())
69+
70+
return &BaseTriggerCapability{
71+
store: store,
72+
send: send,
73+
lost: lost,
74+
lggr: lggr,
75+
tRetransmit: tRetransmit,
76+
tMax: tMax,
77+
pending: make(map[string]*PendingEvent),
78+
ctx: ctx,
79+
cancel: cancel,
80+
}
6781
}
6882

6983
// If you want logs:

0 commit comments

Comments
 (0)