2015-09-02 18:48:03 +00:00
|
|
|
package com.github.reiseburo.beetle;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple POJO containing informtaion about a Kafka broker
|
|
|
|
*/
|
|
|
|
public class Broker {
|
|
|
|
private String host;
|
2015-09-02 19:39:49 +00:00
|
|
|
|
|
|
|
private String brokerId;
|
2015-09-02 18:48:03 +00:00
|
|
|
private int port;
|
|
|
|
private int jmxPort;
|
|
|
|
|
|
|
|
public String getHost() {
|
|
|
|
return this.host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getPort() {
|
|
|
|
return port;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getJmxPort() {
|
|
|
|
return jmxPort;
|
|
|
|
}
|
|
|
|
|
2015-09-02 19:39:49 +00:00
|
|
|
public String getBrokerId() {
|
|
|
|
return brokerId;
|
|
|
|
}
|
|
|
|
|
2015-09-02 18:48:03 +00:00
|
|
|
public static class Builder {
|
|
|
|
private int port;
|
|
|
|
private int jmxPort;
|
|
|
|
private String host;
|
2015-09-02 19:39:49 +00:00
|
|
|
private String brokerId;
|
2015-09-02 18:48:03 +00:00
|
|
|
|
|
|
|
public Builder withHost(String hostName) {
|
|
|
|
this.host = hostName;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Builder withPort(int port) {
|
|
|
|
this.port = port;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Builder withJMXPort(int port) {
|
|
|
|
this.jmxPort = port;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2015-09-02 19:39:49 +00:00
|
|
|
public Builder withBrokerId(String id) {
|
|
|
|
this.brokerId = id;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2015-09-02 18:48:03 +00:00
|
|
|
public Broker build() {
|
|
|
|
return new Broker(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Builder builder() {
|
|
|
|
return new Builder();
|
|
|
|
}
|
|
|
|
|
|
|
|
private Broker(Builder builder) {
|
2015-09-02 19:39:49 +00:00
|
|
|
this.brokerId = builder.brokerId;
|
2015-09-02 18:48:03 +00:00
|
|
|
this.host = builder.host;
|
|
|
|
this.port = builder.port;
|
|
|
|
this.jmxPort = builder.jmxPort;
|
|
|
|
}
|
2015-09-02 19:39:49 +00:00
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return String.format("<Broker:%d (%s %s:%d [jmx:%d])>",
|
|
|
|
hashCode(), brokerId, host, port, jmxPort);
|
|
|
|
}
|
2015-09-02 18:48:03 +00:00
|
|
|
}
|