|
@@ -11,6 +11,27 @@ import (
|
|
|
"runtime/debug"
|
|
|
)
|
|
|
|
|
|
+// ----------------------------------------------------------------------------------
|
|
|
+// Processor Name: mysql
|
|
|
+// ----------------------------------------------------------------------------------
|
|
|
+// Description : Saves the e.Data (email data) and e.DeliveryHeader together in mysql
|
|
|
+// : using the hash generated by the "hash" processor and stored in
|
|
|
+// : e.Hashes
|
|
|
+// ----------------------------------------------------------------------------------
|
|
|
+// Config Options: mail_table string - mysql table name
|
|
|
+// : mysql_db string - mysql database name
|
|
|
+// : mysql_host string - mysql host name, eg. 127.0.0.1
|
|
|
+// : mysql_pass string - mysql password
|
|
|
+// : mysql_user string - mysql username
|
|
|
+// : primary_mail_host string - primary host name
|
|
|
+// --------------:-------------------------------------------------------------------
|
|
|
+// Input : e.Data
|
|
|
+// : e.DeliveryHeader generated by ParseHeader() processor
|
|
|
+// : e.MailFrom
|
|
|
+// : e.Subject - generated by by ParseHeader() processor
|
|
|
+// ----------------------------------------------------------------------------------
|
|
|
+// Output : No output, just saves to mysql
|
|
|
+// ----------------------------------------------------------------------------------
|
|
|
func init() {
|
|
|
Processors["mysql"] = func() Decorator {
|
|
|
return MySql()
|
|
@@ -18,15 +39,12 @@ func init() {
|
|
|
}
|
|
|
|
|
|
type MysqlProcessorConfig struct {
|
|
|
- NumberOfWorkers int `json:"save_workers_size"`
|
|
|
- MysqlTable string `json:"mail_table"`
|
|
|
- MysqlDB string `json:"mysql_db"`
|
|
|
- MysqlHost string `json:"mysql_host"`
|
|
|
- MysqlPass string `json:"mysql_pass"`
|
|
|
- MysqlUser string `json:"mysql_user"`
|
|
|
- RedisExpireSeconds int `json:"redis_expire_seconds"`
|
|
|
- RedisInterface string `json:"redis_interface"`
|
|
|
- PrimaryHost string `json:"primary_mail_host"`
|
|
|
+ MysqlTable string `json:"mail_table"`
|
|
|
+ MysqlDB string `json:"mysql_db"`
|
|
|
+ MysqlHost string `json:"mysql_host"`
|
|
|
+ MysqlPass string `json:"mysql_pass"`
|
|
|
+ MysqlUser string `json:"mysql_user"`
|
|
|
+ PrimaryHost string `json:"primary_mail_host"`
|
|
|
}
|
|
|
|
|
|
type MysqlProcessor struct {
|
|
@@ -175,7 +193,7 @@ func MySql() Decorator {
|
|
|
vals = append(vals, co.String())
|
|
|
//co.clear()
|
|
|
} else {
|
|
|
- vals = append(vals, e.DeliveryHeader+e.Data.String())
|
|
|
+ vals = append(vals, e.String())
|
|
|
}
|
|
|
|
|
|
vals = append(vals,
|