MCPcopy
hub / github.com/IBM/sarama / NewSyncProducer

Function NewSyncProducer

sync_producer.go:77–92  ·  view source on GitHub ↗

NewSyncProducer creates a new SyncProducer using the given broker addresses and configuration.

(addrs []string, config *Config)

Source from the content-addressed store, hash-verified

75
76// NewSyncProducer creates a new SyncProducer using the given broker addresses and configuration.
77func NewSyncProducer(addrs []string, config *Config) (SyncProducer, error) {
78 if config == nil {
79 config = NewConfig()
80 config.Producer.Return.Successes = true
81 }
82
83 if err := verifyProducerConfig(config); err != nil {
84 return nil, err
85 }
86
87 p, err := NewAsyncProducer(addrs, config)
88 if err != nil {
89 return nil, err
90 }
91 return newSyncProducerFromAsyncProducer(p.(*asyncProducer)), nil
92}
93
94// NewSyncProducerFromClient creates a new SyncProducer using the given client. It is still
95// necessary to call Close() on the underlying client when shutting down this producer.

Callers 15

mainFunction · 0.92
runSyncProducerFunction · 0.92
mainFunction · 0.92
newDataCollectorFunction · 0.92
produceMsgsFunction · 0.70

Calls 4

verifyProducerConfigFunction · 0.85
NewConfigFunction · 0.70
NewAsyncProducerFunction · 0.70