forked from linkedin/Iris-message-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errorVendor.go
32 lines (24 loc) · 885 Bytes
/
errorVendor.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 main
import (
gometrics "github.com/rcrowley/go-metrics"
)
type ErrorVendor struct {
*Vendor
}
// NewErrorVendor create new ErrorVendor instance
func NewErrorVendor(dbClient *DbClient, config *Config, logger *Logger, metricsRegistry *gometrics.Registry) *ErrorVendor {
vendor := NewVendor(dbClient, config, logger, "errorVendor")
errorVendor := ErrorVendor{Vendor: vendor}
if appConfig.MetricsDryRun == false && metricsRegistry != nil {
errorVendor.Vendor.RegisterMetrics(*metricsRegistry)
}
return &errorVendor
}
func (d *ErrorVendor) SendMessage(message MessageQueueItem) bool {
if d.config.StorageDryRun {
d.logger.Infof("ErrorVendor SendMessage: %s, %s, %s ", message.message.Target, message.message.Mode, message.message.Destination)
}
d.Vendor.persistMsg(message, "", "Notification failed to build")
d.Vendor.counterSuccesses.Inc(1)
return true
}