Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch processor keeps data points queued on failed write #119

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<packaging>jar</packaging>
<version>2.0-SNAPSHOT</version>
<version>2.1-SS-SNAPSHOT</version>
<name>influxdb java bindings</name>
<description>Java API to access the InfluxDB REST API</description>
<url>http://www.influxdb.org</url>
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/org/influxdb/InfluxDBFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;

import java.util.concurrent.TimeUnit;

/**
* A Factory to create a instance of a InfluxDB Database adapter.
*
Expand All @@ -25,9 +27,29 @@ public enum InfluxDBFactory {
* @return a InfluxDB adapter suitable to access a InfluxDB.
*/
public static InfluxDB connect(final String url, final String username, final String password) {
return connect(url, username, password, 0, null);
}

/**
* Create a connection to a InfluxDB.
*
* @param url
* the url to connect to.
* @param username
* the username which is used to authorize against the influxDB instance.
* @param password
* the password for the username which is used to authorize against the influxDB
* instance.
* @param networkTimeout
* the period of time to try to connect to the influxDB database
* @param timeoutTimeUnit
* the unit of time that the network timeout parameter is measured
* @return a InfluxDB adapter suitable to access a InfluxDB.
*/
public static InfluxDB connect(final String url, final String username, final String password, final long networkTimeout, final TimeUnit timeoutTimeUnit) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(url), "The URL may not be null or empty.");
Preconditions.checkArgument(!Strings.isNullOrEmpty(username), "The username may not be null or empty.");
return new InfluxDBImpl(url, username, password);
return new InfluxDBImpl(url, username, password, networkTimeout, timeoutTimeUnit);
}

}
7 changes: 7 additions & 0 deletions src/main/java/org/influxdb/dto/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ public String lineProtocol() {
return sb.toString();
}

/**
* Gets the time related to the Point
*
* @return The time related to the Point
*/
public Long getTime(){return time;}

private StringBuilder concatenatedTags() {
final StringBuilder sb = new StringBuilder();
for (Entry<String, String> tag : this.tags.entrySet()) {
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/org/influxdb/impl/BatchEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.influxdb.impl;

import org.influxdb.dto.Point;

/**
* Created by Paul on 11/17/2015.
*/
public class BatchEntry {
private final Point point;
private final String db;
private final String rp;

public BatchEntry(final Point point, final String db, final String rp) {
super();
this.point = point;
this.db = db;
this.rp = rp;
}

public Point getPoint() {
return this.point;
}

public String getDb() {
return this.db;
}

public String getRp() {
return this.rp;
}
}
Loading