in azure/azure-storage-blob/src/main/java/org/apache/camel/example/azurestorageblob/Application.java [51:80]
static RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("timer://runOnce?repeatCount=1&delay=0")
.routeId("listBlobs")
.process(exchange -> exchange.getIn()
.setBody(
new BlobServiceClientBuilder()
.endpoint(String.format("https://%s.blob.core.windows.net", ACCOUNT))
.credential(new StorageSharedKeyCredential(ACCOUNT, ACCESS_KEY))
.buildClient()
.getBlobContainerClient(BLOB_CONTAINER_NAME)
.listBlobs(
new ListBlobsOptions().setMaxResultsPerPage(1),
null
)
)
)
.loopDoWhile(exchange ->
exchange.getIn().getBody(Iterator.class).hasNext()
)
.process(exchange ->
exchange.getIn().setBody(exchange.getIn().getBody(Iterator.class).next())
)
.log("${body.name}")
.end();
}
};
}