forked from project-flogo/contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.go
38 lines (31 loc) · 1.36 KB
/
metadata.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
33
34
35
36
37
38
package kafka
import (
"github.com/project-flogo/core/data/coerce"
)
type Settings struct {
BrokerUrls string `md:"brokerUrls,required"` // The Kafka cluster to connect to
User string `md:"user"` // If connecting to a SASL enabled port, the user id to use for authentication
Password string `md:"password"` // If connecting to a SASL enabled port, the password to use for authentication
TrustStore string `md:"trustStore"` // If connecting to a TLS secured port, the directory containing the certificates representing the trust chain for the connection. This is usually just the CACert used to sign the server's certificate
}
type HandlerSettings struct {
Topic string `md:"topic,required"` // The Kafka topic on which to listen for messageS
Partitions string `md:"partitions"` // The specific partitions to consume messages from
Offset int64 `md:"offset"` // The offset to use when starting to consume messages, default is set to Newest
}
type Output struct {
Message string `md:"message"` // The message that was consumed
}
func (o *Output) ToMap() map[string]interface{} {
return map[string]interface{}{
"message": o.Message,
}
}
func (o *Output) FromMap(values map[string]interface{}) error {
var err error
o.Message, err = coerce.ToString(values["message"])
if err != nil {
return err
}
return nil
}