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

Adding disableStreamCache=true on every http call #66

Closed
wants to merge 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ public void configure() {
.setHeader("X-Islandora-Args", simple("${exchangeProperty.event.attachment.content.args}"))
.setHeader("Apix-Ldp-Resource", simple("${exchangeProperty.event.attachment.content.sourceUri}"))
.setBody(simple("${null}"))
.to("{{derivative.service.url}}?connectionClose=true")
.to("{{derivative.service.url}}?connectionClose=true&disableStreamCache=true")

// PUT the media.
.removeHeaders("*", "Authorization", "Content-Type")
.setHeader("Content-Location", simple("${exchangeProperty.event.attachment.content.fileUploadUri}"))
.setHeader(Exchange.HTTP_METHOD, constant("PUT"))
.toD("${exchangeProperty.event.attachment.content.destinationUri}?connectionClose=true");
.toD("${exchangeProperty.event.attachment.content.destinationUri}" +
"?connectionClose=true&disableStreamCache=true"
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ public void configure() throws Exception {
replaceFromWith("direct:start");

// Rig Drupal REST endpoint to return canned jsonld
interceptSendToEndpoint("http://example.org/derivative/convert?connectionClose=true")
final String endpoint = "http://example.org/derivative/convert" +
"?connectionClose=true&disableStreamCache=true";
interceptSendToEndpoint(endpoint)
.skipSendToOriginalEndpoint()
.process(exchange -> {
exchange.getIn().removeHeaders("*", "Authorization");
exchange.getIn().setHeader("Content-Type", "image/jpeg");
exchange.getIn().setBody("SOME DERIVATIVE", String.class);
});

mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3?connectionClose=true");
mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3" +
"?connectionClose=true&disableStreamCache=true");
}
});
context.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,16 @@ public void configure() {
.setBody(simple("${null}"))
.multicast().parallelProcessing()
//pass it to milliner
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true")
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true")
.choice()
.when()
.simple("${exchangeProperty.event.object.isNewVersion}")
//pass it to milliner
.toD(
getMillinerBaseUrl() + "version/${exchangeProperty.uuid}?connectionClose=true"
getMillinerBaseUrl() + "version/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true"
).endChoice();



from("{{node.delete.stream}}")
.routeId("FcrepoIndexerDeleteNode")
.onException(HttpOperationFailedException.class)
Expand Down Expand Up @@ -201,7 +200,9 @@ public void configure() {
.setBody(simple("${null}"))

// Remove the file from Gemini.
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true");
.toD(getMillinerBaseUrl() +
"node/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true"
);

from("{{media.stream}}")
.routeId("FcrepoIndexerMedia")
Expand All @@ -225,7 +226,9 @@ public void configure() {
.setBody(simple("${null}"))

// Pass it to milliner.
.toD(getMillinerBaseUrl() + "media/${exchangeProperty.sourceField}?connectionClose=true");
.toD(getMillinerBaseUrl() +
"media/${exchangeProperty.sourceField}?connectionClose=true&disableStreamCache=true"
);

from("{{file.stream}}")
.routeId("FcrepoIndexerFile")
Expand Down Expand Up @@ -253,7 +256,7 @@ public void configure() {
)

// Index the file in Gemini.
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true");
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true");

from("{{file.external.stream}}")
.routeId("FcrepoIndexerExternalFile")
Expand All @@ -277,7 +280,9 @@ public void configure() {
.setBody(simple("${null}"))

// Pass it to milliner.
.toD(getMillinerBaseUrl() + "external/${exchangeProperty.uuid}?connectionClose=true");
.toD(getMillinerBaseUrl() +
"external/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true"
);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public void testNode() throws Exception {
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip(
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
Expand Down Expand Up @@ -130,7 +131,8 @@ public void testNodeDelete() throws Exception {
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip(
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
Expand Down Expand Up @@ -165,7 +167,8 @@ public void testFile() throws Exception {
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip(
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
Expand Down Expand Up @@ -205,7 +208,8 @@ public void testExternalFile() throws Exception {
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip(
"http://localhost:8000/milliner/external/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
"http://localhost:8000/milliner/external/148dfe8f-9711-4263-97e7-3ef3fb15864f" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
Expand Down Expand Up @@ -243,7 +247,9 @@ public void testMedia() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image?connectionClose=true");
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
context.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ public void configure() {
.removeHeaders("*", "Authorization")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setBody(simple("${null}"))
.toD("${exchangeProperty.jsonld_url}&connectionClose=true")
.toD("${exchangeProperty.jsonld_url}&connectionClose=true&disableStreamCache=true")
.setHeader(FCREPO_URI, simple("${exchangeProperty.subject_url}"))
.process(new SparqlUpdateProcessor())
.log(INFO, LOGGER, "Indexing ${exchangeProperty.subject_url} in triplestore")
.to("{{triplestore.baseUrl}}?connectionClose=true");
.to("{{triplestore.baseUrl}}?connectionClose=true&disableStreamCache=true");

from("{{delete.stream}}")
.routeId("IslandoraTriplestoreIndexerDelete")
.to("direct:parse.url")
.setHeader(FCREPO_URI, simple("${exchangeProperty.subject_url}"))
.process(new SparqlDeleteProcessor())
.log(INFO, LOGGER, "Deleting ${exchangeProperty.subject_url} in triplestore")
.to("{{triplestore.baseUrl}}?connectionClose=true");
.to("{{triplestore.baseUrl}}?connectionClose=true&disableStreamCache=true");

// Extracts the JSONLD URL from the event message and stores it on the exchange.
from("direct:parse.url")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ public void configure() throws Exception {
replaceFromWith("direct:start");

// Rig Drupal REST endpoint to return canned jsonld
interceptSendToEndpoint("http://localhost:8000/node/1?_format=jsonld&connectionClose=true")
final String endpoint = "http://localhost:8000/node/1" +
"?_format=jsonld&connectionClose=true&disableStreamCache=true";
interceptSendToEndpoint(endpoint)
.skipSendToOriginalEndpoint()
.process(exchange -> {
exchange.getIn().removeHeaders("*");
Expand All @@ -147,7 +149,8 @@ public void configure() throws Exception {
});

mockEndpointsAndSkip(
"http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true"
"http://localhost:8080/bigdata/namespace/islandora/sparql" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
Expand Down Expand Up @@ -188,7 +191,9 @@ public void testDelete() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true");
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql" +
"?connectionClose=true&disableStreamCache=true"
);
}
});
context.start();
Expand Down