pub fn new(hosts: Vec<String>) -> KafkaClient {
        KafkaClient {
            config: ClientConfig {
                client_id: CLIENTID.to_owned(),
                hosts: hosts,
                compression: DEFAULT_COMPRESSION,
                fetch_max_wait_time: protocol::to_millis_i32(
                    Duration::from_millis(DEFAULT_FETCH_MAX_WAIT_TIME_MILLIS))
                    .expect("invalid default-fetch-max-time-millis"),
                fetch_min_bytes: DEFAULT_FETCH_MIN_BYTES,
                fetch_max_bytes_per_partition: DEFAULT_FETCH_MAX_BYTES_PER_PARTITION,
                fetch_crc_validation: DEFAULT_FETCH_CRC_VALIDATION,
                offset_fetch_version: DEFAULT_GROUP_OFFSET_STORAGE.offset_fetch_version(),
                offset_commit_version: DEFAULT_GROUP_OFFSET_STORAGE.offset_commit_version(),
                retry_backoff_time: Duration::from_millis(DEFAULT_RETRY_BACKOFF_TIME_MILLIS),
                retry_max_attempts: DEFAULT_RETRY_MAX_ATTEMPTS,
            },
            conn_pool: network::Connections::new(
                default_conn_rw_timeout(),
                Duration::from_millis(DEFAULT_CONNECTION_IDLE_TIMEOUT_MILLIS)),
            state: state::ClientState::new(),
        }
    }
/// Creates a new instance of KafkaClient. Before being able to
/// successfully use the new client, you'll have to load metadata.
///
/// # Examples
///
/// ```no_run
/// let mut client = kafka::client::KafkaClient::new(vec!("localhost:9092".to_owned()));
/// client.load_metadata_all().unwrap();
/// ```
Creates a new instance of KafkaClient. Before being able to
successfully use the new client, you'll have to load metadata.
Creates a new instance of KafkaClient . Before being able to successfully use the new client you ' ll have to load metadata .
pub fn new(hosts: Vec<String>) -> KafkaClient {
        KafkaClient {
            config: ClientConfig {
                client_id: CLIENTID.to_owned(),
                hosts: hosts,
                compression: DEFAULT_COMPRESSION,
                fetch_max_wait_time: protocol::to_millis_i32(
                    Duration::from_millis(DEFAULT_FETCH_MAX_WAIT_TIME_MILLIS))
                    .expect("invalid default-fetch-max-time-millis"),
                fetch_min_bytes: DEFAULT_FETCH_MIN_BYTES,
                fetch_max_bytes_per_partition: DEFAULT_FETCH_MAX_BYTES_PER_PARTITION,
                fetch_crc_validation: DEFAULT_FETCH_CRC_VALIDATION,
                offset_fetch_version: DEFAULT_GROUP_OFFSET_STORAGE.offset_fetch_version(),
                offset_commit_version: DEFAULT_GROUP_OFFSET_STORAGE.offset_commit_version(),
                retry_backoff_time: Duration::from_millis(DEFAULT_RETRY_BACKOFF_TIME_MILLIS),
                retry_max_attempts: DEFAULT_RETRY_MAX_ATTEMPTS,
            },
            conn_pool: network::Connections::new(
                default_conn_rw_timeout(),
                Duration::from_millis(DEFAULT_CONNECTION_IDLE_TIMEOUT_MILLIS)),
            state: state::ClientState::new(),
        }
    }
pub fn new ( hosts : Vec < String > ) -> KafkaClient { KafkaClient { config : ClientConfig { client_id : CLIENTID . to_owned ( ) , hosts : hosts , compression : DEFAULT_COMPRESSION , fetch_max_wait_time : protocol :: to_millis_i32 ( Duration :: from_millis ( DEFAULT_FETCH_MAX_WAIT_TIME_MILLIS ) ) . expect ( " " ) , fetch_min_bytes : DEFAULT_FETCH_MIN_BYTES , fetch_max_bytes_per_partition : DEFAULT_FETCH_MAX_BYTES_PER_PARTITION , fetch_crc_validation : DEFAULT_FETCH_CRC_VALIDATION , offset_fetch_version : DEFAULT_GROUP_OFFSET_STORAGE . offset_fetch_version ( ) , offset_commit_version : DEFAULT_GROUP_OFFSET_STORAGE . offset_commit_version ( ) , retry_backoff_time : Duration :: from_millis ( DEFAULT_RETRY_BACKOFF_TIME_MILLIS ) , retry_max_attempts : DEFAULT_RETRY_MAX_ATTEMPTS , } , conn_pool : network :: Connections :: new ( default_conn_rw_timeout ( ) , Duration :: from_millis ( DEFAULT_CONNECTION_IDLE_TIMEOUT_MILLIS ) ) , state : state :: ClientState :: new ( ) , } }
Creates a new instance of KafkaClient.
Creates a new instance of KafkaClient .
hosts
Vec<String>
examples
```no_run
let mut client = kafka::client::KafkaClient::new(vec!("localhost:9092".to_owned()));
client.load_metadata_all().unwrap();
```
` ` ` no_run let mut client = kafka :: client :: KafkaClient :: new ( vec! ( " localhost : 9092 " . to_owned () )) ; client . load_metadata_all () . unwrap () ; ` ` `