NewSyncProducerFromClient creates a new SyncProducer using the given client. It is still necessary to call Close() on the underlying client when shutting down this producer.
(client Client)
| 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. |
| 96 | func NewSyncProducerFromClient(client Client) (SyncProducer, error) { |
| 97 | if err := verifyProducerConfig(client.Config()); err != nil { |
| 98 | return nil, err |
| 99 | } |
| 100 | |
| 101 | p, err := NewAsyncProducerFromClient(client) |
| 102 | if err != nil { |
| 103 | return nil, err |
| 104 | } |
| 105 | return newSyncProducerFromAsyncProducer(p.(*asyncProducer)), nil |
| 106 | } |
| 107 | |
| 108 | func newSyncProducerFromAsyncProducer(p *asyncProducer) *syncProducer { |
| 109 | sp := &syncProducer{producer: p} |