Transport is an implementation of the RoundTripper interface. Transport values manage a pool of connections and automatically discovers the clusters layout to route requests to the appropriate brokers. Transport values are safe to use concurrently from multiple goroutines. Note: The intent is for
| 55 | // Note: The intent is for the Transport to become the underlying layer of the |
| 56 | // kafka.Reader and kafka.Writer types. |
| 57 | type Transport struct { |
| 58 | // A function used to establish connections to the kafka cluster. |
| 59 | Dial func(context.Context, string, string) (net.Conn, error) |
| 60 | |
| 61 | // Time limit set for establishing connections to the kafka cluster. This |
| 62 | // limit includes all round trips done to establish the connections (TLS |
| 63 | // handshake, SASL negotiation, etc...). |
| 64 | // |
| 65 | // Defaults to 5s. |
| 66 | DialTimeout time.Duration |
| 67 | |
| 68 | // Maximum amount of time that connections will remain open and unused. |
| 69 | // The transport will manage to automatically close connections that have |
| 70 | // been idle for too long, and re-open them on demand when the transport is |
| 71 | // used again. |
| 72 | // |
| 73 | // Defaults to 30s. |
| 74 | IdleTimeout time.Duration |
| 75 | |
| 76 | // TTL for the metadata cached by this transport. Note that the value |
| 77 | // configured here is an upper bound, the transport randomizes the TTLs to |
| 78 | // avoid getting into states where multiple clients end up synchronized and |
| 79 | // cause bursts of requests to the kafka broker. |
| 80 | // |
| 81 | // Default to 6s. |
| 82 | MetadataTTL time.Duration |
| 83 | |
| 84 | // Topic names for the metadata cached by this transport. If this field is left blank, |
| 85 | // metadata information of all topics in the cluster will be retrieved. |
| 86 | MetadataTopics []string |
| 87 | |
| 88 | // Unique identifier that the transport communicates to the brokers when it |
| 89 | // sends requests. |
| 90 | ClientID string |
| 91 | |
| 92 | // An optional configuration for TLS connections established by this |
| 93 | // transport. |
| 94 | // |
| 95 | // If the Server |
| 96 | TLS *tls.Config |
| 97 | |
| 98 | // SASL configures the Transfer to use SASL authentication. |
| 99 | SASL sasl.Mechanism |
| 100 | |
| 101 | // An optional resolver used to translate broker host names into network |
| 102 | // addresses. |
| 103 | // |
| 104 | // The resolver will be called for every request (not every connection), |
| 105 | // making it possible to implement ACL policies by validating that the |
| 106 | // program is allowed to connect to the kafka broker. This also means that |
| 107 | // the resolver should probably provide a caching layer to avoid storming |
| 108 | // the service discovery backend with requests. |
| 109 | // |
| 110 | // When set, the Dial function is not responsible for performing name |
| 111 | // resolution, and is always called with a pre-resolved address. |
| 112 | Resolver BrokerResolver |
| 113 | |
| 114 | // The background context used to control goroutines started internally by |
nothing calls this directly
no outgoing calls
no test coverage detected