Skip to content

Commit b233d35

Browse files
Wired up the database consumer and the event aggreagator to the main func in the coordinator package.
1 parent 9212a07 commit b233d35

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/distributed/coordinator/exec/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ import (
55
"fmt"
66
)
77

8+
var dc *coordinator.DatabaseConsumer
9+
810
func main() {
9-
ql := coordinator.NewQueueListener()
11+
12+
// wiring event aggreagtor to coordinator package
13+
ea := coordinator.NewEventAggregator()
14+
// instantiating package level databse consumer
15+
dc := coordinator.NewDataConsumer(ea)
16+
17+
ql := coordinator.NewQueueListener(ea)
1018
go ql.ListenForNewSource()
1119

1220
var a string

src/distributed/coordinator/queuelistener.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ type QueueListener struct {
3232
// NewQueueListener is a constructor function
3333
// that ensures that the QueueListener is
3434
// properly initialized
35-
func NewQueueListener() *QueueListener {
35+
func NewQueueListener(ea *EventAggregator) *QueueListener {
3636
//instantiating new object of queuelistener
3737
ql := QueueListener{
3838
sources: make(map[string]<-chan amqp.Delivery),
39-
ea: NewEventAggregator(),
39+
ea: ea,
4040
}
4141

4242
//populating the Connection and Channel fields

0 commit comments

Comments
 (0)