Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Deprecate replication parameter
Browse files Browse the repository at this point in the history
`replication:async` has been deprecated in elasticsearch 1.5.0 and removed in master (2.0.0). See elastic/elasticsearch#10114.

We need to do the same in RabbitMQ river plugin.

Closes #91.
(cherry picked from commit fc3f394)
  • Loading branch information
dadoonet committed Mar 31, 2015
1 parent 2da41c5 commit 1df982b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.collect.Maps;
Expand Down Expand Up @@ -83,7 +82,6 @@ public class RabbitmqRiver extends AbstractRiverComponent implements River {
private final int bulkSize;
private final TimeValue bulkTimeout;
private final boolean ordered;
private final ReplicationType replicationType;

private final ExecutableScript bulkScript;
private final ExecutableScript script;
Expand Down Expand Up @@ -198,12 +196,15 @@ public RabbitmqRiver(RiverName riverName, RiverSettings settings, Client client,
bulkTimeout = TimeValue.timeValueMillis(10);
}
ordered = XContentMapValues.nodeBooleanValue(indexSettings.get("ordered"), false);
replicationType = ReplicationType.fromString(XContentMapValues.nodeStringValue(indexSettings.get("replication"), "default"));

// TODO Remove in 3.0.0
if (indexSettings.get("replication") != null) {
logger.warn("replication has been deprecated and will be removed in a future version. Using sync now.");
}
} else {
bulkSize = 100;
bulkTimeout = TimeValue.timeValueMillis(10);
ordered = false;
replicationType = ReplicationType.DEFAULT;
}

if (settings.settings().containsKey("rabbitmq")) {
Expand Down Expand Up @@ -377,7 +378,7 @@ public void run() {
if (task != null && task.getBody() != null) {
final List<Long> deliveryTags = Lists.newArrayList();

BulkRequestBuilder bulkRequestBuilder = client.prepareBulk().setReplicationType(replicationType);
BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();

try {
processBody(task.getBody(), bulkRequestBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ public void testSimpleRiver() throws Exception {
.endObject(), randomIntBetween(1, 10), randomIntBetween(1, 500), null, true, true);
}

@Test
// TODO Remove in 3.0.0
@Test @Deprecated
public void testAsyncReplication() throws Exception {
launchTest(jsonBuilder()
.startObject()
Expand Down

0 comments on commit 1df982b

Please sign in to comment.