io.vertx.core.streams.ReadStream Java Examples
The following examples show how to use
io.vertx.core.streams.ReadStream.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoClientTest.java From vertx-mongo-client with Apache License 2.0 | 6 votes |
private void testFindBatch(int numDocs, BiFunction<CountDownLatch, ReadStream<JsonObject>, List<String>> checker) throws Exception { AtomicReference<ReadStream<JsonObject>> streamReference = new AtomicReference<>(); String collection = randomCollection(); CountDownLatch latch = new CountDownLatch(1); AtomicReference<List<String>> foos = new AtomicReference<>(); mongoClient.createCollection(collection, onSuccess(res -> { insertDocs(mongoClient, collection, numDocs, onSuccess(res2 -> { FindOptions findOptions = new FindOptions().setSort(new JsonObject().put("counter", 1)).setBatchSize(1); ReadStream<JsonObject> stream = mongoClient.findBatchWithOptions(collection, new JsonObject(), findOptions); streamReference.set(stream); foos.set(checker.apply(latch, stream)); })); })); awaitLatch(latch); assertEquals(numDocs, foos.get().size()); assertEquals("bar0", foos.get().get(0)); assertEquals("bar" + (numDocs - 1), foos.get().get(numDocs - 1)); // Make sure stream handlers can be set to null after closing streamReference.get().handler(null).exceptionHandler(null).endHandler(null); }
Example #2
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailSimpleSimpleNonFileAttachmentStreamCacheInFileWithLimit(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "true"); this.testContext = testContext; Buffer fakeData = fakeStreamData(); byte[] fakeDataBytes = fakeData.getBytes(); ReadStream<Buffer> fakeStream = new FakeReadStream(vertx.getOrCreateContext()); MailAttachment attachment = MailAttachment.create().setName("FakeStream") .setStream(fakeStream) .setSize(fakeDataBytes.length); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase).setBodyLimit(50) .setHeaderCanonAlgo(CanonicalizationAlgorithm.SIMPLE).setBodyCanonAlgo(CanonicalizationAlgorithm.SIMPLE); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(fakeDataBytes, inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #3
Source File: S3Client.java From vertx-s3-client with Apache License 2.0 | 6 votes |
public void getObject(String bucket, String key, GetObjectRequest getObjectRequest, Handler<Response<GetObjectResponseHeaders, ReadStream<Buffer>>> handler, Handler<Throwable> exceptionHandler) { checkNotNull(StringUtils.trimToNull(bucket), "bucket must not be null"); checkNotNull(StringUtils.trimToNull(key), "key must not be null"); checkNotNull(getObjectRequest, "getObjectRequest must not be null"); checkNotNull(handler, "handler must not be null"); checkNotNull(exceptionHandler, "exceptionHandler must not be null"); final S3ClientRequest request = createGetRequest( bucket, key, getObjectRequest, new StreamResponseHandler("getObject", jaxbUnmarshaller, new GetResponseHeadersMapper(), handler, exceptionHandler) ); request.exceptionHandler(exceptionHandler); request.end(); }
Example #4
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailSimpleSimpleNonFileAttachmentStreamCacheInFile(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "true"); this.testContext = testContext; Buffer fakeData = fakeStreamData(); byte[] fakeDataBytes = fakeData.getBytes(); ReadStream<Buffer> fakeStream = new FakeReadStream(vertx.getOrCreateContext()); MailAttachment attachment = MailAttachment.create().setName("FakeStream") .setStream(fakeStream) .setSize(fakeDataBytes.length); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase) .setHeaderCanonAlgo(CanonicalizationAlgorithm.SIMPLE).setBodyCanonAlgo(CanonicalizationAlgorithm.SIMPLE); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(fakeDataBytes, inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #5
Source File: ProxyService.java From okapi with Apache License 2.0 | 6 votes |
private void proxyRequestLog(Iterator<ModuleInstance> it, ProxyContext pc, ReadStream<Buffer> stream, Buffer bcontent, List<HttpClientRequest> clientRequestList, ModuleInstance mi) { RoutingContext ctx = pc.getCtx(); HttpClientRequest clientRequest = httpClient.requestAbs(ctx.request().method(), makeUrl(mi, ctx), res -> logger.debug("proxyRequestLog 2")); clientRequestList.add(clientRequest); clientRequest.setChunked(true); if (!it.hasNext()) { relayToResponse(ctx.response(), null, pc); copyHeaders(clientRequest, ctx, mi); proxyResponseImmediate(pc, stream, bcontent, clientRequestList); } else { copyHeaders(clientRequest, ctx, mi); proxyR(it, pc, stream, bcontent, clientRequestList); } log(pc, clientRequest); }
Example #6
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailSimpleSimpleAttachmentStream(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "true"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName(path).setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase) .setHeaderCanonAlgo(CanonicalizationAlgorithm.SIMPLE).setBodyCanonAlgo(CanonicalizationAlgorithm.SIMPLE); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #7
Source File: MainVerticle.java From okapi with Apache License 2.0 | 6 votes |
/** * Simple test to fake a _tenantPermission interface. * Captures the body, and reports it in a header. * * @param ctx routing context */ private void myPermissionHandle(RoutingContext ctx) { ReadStream<Buffer> content = ctx.request(); final Buffer incoming = Buffer.buffer(); content.handler(incoming::appendBuffer); ctx.request().endHandler(x -> { String body = incoming.toString(); body = body.replaceAll("\\s+", " "); // remove newlines etc ctx.response().putHeader("X-Tenant-Perms-Result", body); if (body.length() > 80) { body = body.substring(0, 80) + "..."; } logger.info("tenantPermissions: {}", body); ctx.response().end(); }); }
Example #8
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailSimpleRelaxedAttachmentStream(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "false"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName("logo-white-big.png").setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase) .setHeaderCanonAlgo(CanonicalizationAlgorithm.SIMPLE).setBodyCanonAlgo(CanonicalizationAlgorithm.RELAXED); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #9
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailRelaxedSimpleAttachmentStream(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "true"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName("logo-white-big.png").setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase) .setHeaderCanonAlgo(CanonicalizationAlgorithm.RELAXED).setBodyCanonAlgo(CanonicalizationAlgorithm.SIMPLE); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #10
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailRelaxedRelaxedAttachmentStream(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "false"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName("logo-white-big.png").setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase) .setHeaderCanonAlgo(CanonicalizationAlgorithm.RELAXED).setBodyCanonAlgo(CanonicalizationAlgorithm.RELAXED); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #11
Source File: WebClientExamples.java From vertx-web with Apache License 2.0 | 6 votes |
public void sendStream(WebClient client, FileSystem fs) { fs.open("content.txt", new OpenOptions(), fileRes -> { if (fileRes.succeeded()) { ReadStream<Buffer> fileStream = fileRes.result(); String fileLen = "1024"; // Send the file to the server using POST client .post(8080, "myserver.mycompany.com", "/some-uri") .putHeader("content-length", fileLen) .sendStream(fileStream) .onSuccess(res -> { // OK }) ; } }); }
Example #12
Source File: PumpFromPart.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
private CompletableFuture<ReadStream<Buffer>> prepareReadStream() { CompletableFuture<ReadStream<Buffer>> future = new CompletableFuture<>(); if (ReadStreamPart.class.isInstance(part)) { future.complete(((ReadStreamPart) part).getReadStream()); return future; } try { InputStream inputStream = part.getInputStream(); InputStreamToReadStream inputStreamToReadStream = new InputStreamToReadStream(context, inputStream, true); inputStreamToReadStream.pause(); future.complete(inputStreamToReadStream); } catch (IOException e) { future.completeExceptionally(e); } return future; }
Example #13
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailRelaxedRelaxedAttachmentStreamWithLimit(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "true"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName("logo-white-big.png").setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase).setBodyLimit(100) .setHeaderCanonAlgo(CanonicalizationAlgorithm.RELAXED).setBodyCanonAlgo(CanonicalizationAlgorithm.RELAXED); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #14
Source File: MailWithDKIMSignTest.java From vertx-mail-client with Apache License 2.0 | 6 votes |
@Test public void testMailRelaxedSimpleAttachmentStreamWithLimit(TestContext testContext) { System.setProperty("vertx.mail.attachment.cache.file", "false"); this.testContext = testContext; String path = "logo-white-big.png"; Buffer img = vertx.fileSystem().readFileBlocking(path); ReadStream<Buffer> stream = vertx.fileSystem().openBlocking(path, new OpenOptions()); MailAttachment attachment = MailAttachment.create().setName("logo-white-big.png").setStream(stream).setSize(img.length()); MailMessage message = exampleMessage().setText(TEXT_BODY).setAttachment(attachment); DKIMSignOptions dkimOps = new DKIMSignOptions(dkimOptionsBase).setBodyLimit(50) .setHeaderCanonAlgo(CanonicalizationAlgorithm.RELAXED).setBodyCanonAlgo(CanonicalizationAlgorithm.SIMPLE); testSuccess(dkimMailClient(dkimOps), message, () -> { final MimeMultipart multiPart = (MimeMultipart)wiser.getMessages().get(0).getMimeMessage().getContent(); testContext.assertEquals(2, multiPart.getCount()); testContext.assertEquals(TEXT_BODY, conv2nl(inputStreamToString(multiPart.getBodyPart(0).getInputStream()))); testContext.assertTrue(Arrays.equals(img.getBytes(), inputStreamToBytes(multiPart.getBodyPart(1).getInputStream()))); testDKIMSign(dkimOps, testContext); }); }
Example #15
Source File: ProxyService.java From okapi with Apache License 2.0 | 5 votes |
private void proxyRequestOnly(Iterator<ModuleInstance> it, ProxyContext pc, ReadStream<Buffer> stream, Buffer bcontent, List<HttpClientRequest> clientRequestList, ModuleInstance mi) { proxyStreamToBuffer(stream, bcontent, res -> proxyRequestHttpClient(it, pc, res, clientRequestList, mi) ); }
Example #16
Source File: ProxyService.java From okapi with Apache License 2.0 | 5 votes |
private void proxyRequestResponse10( Iterator<ModuleInstance> it, ProxyContext pc, ReadStream<Buffer> stream, Buffer bcontent, List<HttpClientRequest> clientRequestList, ModuleInstance mi) { proxyStreamToBuffer(stream, bcontent, res -> proxyRequestResponse(it, pc, null, res, clientRequestList, mi) ); }
Example #17
Source File: PublisherAdapter.java From vertx-mongo-client with Apache License 2.0 | 5 votes |
@Override public ReadStream<T> resume() { synchronized (this) { if (state == State.STOPPED) { return this; } } internalQueue.resume(); return this; }
Example #18
Source File: ProxyService.java From okapi with Apache License 2.0 | 5 votes |
private void proxyRedirect(Iterator<ModuleInstance> it, ProxyContext pc, ReadStream<Buffer> stream, Buffer bcontent, List<HttpClientRequest> clientRequestList, ModuleInstance mi) { pc.trace("ProxyNull " + mi.getModuleDescriptor().getId()); pc.closeTimer(); // if no more entries in it, proxyR will return 404 proxyR(it, pc, stream, bcontent, clientRequestList); }
Example #19
Source File: ReadStreamSubscriber.java From vertx-rx with Apache License 2.0 | 5 votes |
@Override public ReadStream<J> exceptionHandler(Handler<Throwable> handler) { synchronized (this) { if (completed == null || pending.size() > 0) { exceptionHandler = handler; } else { if (handler != null) { throw new IllegalStateException(); } } } return this; }
Example #20
Source File: SMTPSendMail.java From vertx-mail-client with Apache License 2.0 | 5 votes |
private void sendRegularPartBody(EncodedPart part, Promise<Void> promise) { if (part.body() != null) { // send body string line by line sendBodyLineByLine(part.body().split("\n"), 0, promise); } else { ReadStream<Buffer> attachBodyStream = part.bodyStream(connection.getContext()); if (attachBodyStream != null) { attachBodyStream.pipe().endOnComplete(false).to(connection.getSocket(), promise); } else { promise.fail(new IllegalStateException("No mail body and stream found")); } } }
Example #21
Source File: MongoClientImpl.java From vertx-mongo-client with Apache License 2.0 | 5 votes |
@Override public ReadStream<JsonObject> findBatchWithOptions(String collection, JsonObject query, FindOptions options) { requireNonNull(collection, "collection cannot be null"); requireNonNull(query, "query cannot be null"); FindPublisher<JsonObject> view = doFind(collection, query, options); return new PublisherAdapter<>(vertx.getOrCreateContext(), view, options.getBatchSize()); }
Example #22
Source File: ReadStreamSubscriber.java From vertx-rx with Apache License 2.0 | 5 votes |
@Override public ReadStream<J> endHandler(Handler<Void> handler) { synchronized (this) { if (completed == null || pending.size() > 0) { endHandler = handler; } else { if (handler != null) { throw new IllegalStateException(); } } } return this; }
Example #23
Source File: AttachmentPart.java From vertx-mail-client with Apache License 2.0 | 5 votes |
@Override public synchronized ReadStream<Buffer> dkimBodyStream(Context context) { ReadStream<Buffer> attachStream = this.attachment.getStream(); if (attachStream == null) { return null; } return new BodyReadStream(context, attachStream, true); }
Example #24
Source File: ReadStreamSubscriber.java From vertx-rx with Apache License 2.0 | 5 votes |
@Override public ReadStream<J> resume() { synchronized (this) { paused = false; } checkStatus(); return this; }
Example #25
Source File: MongoGridFsClientImpl.java From vertx-mongo-client with Apache License 2.0 | 5 votes |
@Override public Future<String> uploadByFileNameWithOptions(ReadStream<Buffer> stream, String fileName, GridFsUploadOptions options) { GridFSUploadOptions uploadOptions = new GridFSUploadOptions(); uploadOptions.chunkSizeBytes(options.getChunkSizeBytes()); if (options.getMetadata() != null) uploadOptions.metadata(new Document(options.getMetadata().getMap())); GridFSReadStreamPublisher publisher = new GridFSReadStreamPublisher(stream); Promise<ObjectId> promise = vertx.promise(); bucket.uploadFromPublisher(fileName, publisher, uploadOptions).subscribe(new SingleResultSubscriber<>(promise)); return promise.future().map(ObjectId::toHexString); }
Example #26
Source File: ReadStreamSubscriber.java From vertx-rx with Apache License 2.0 | 5 votes |
@Override public ReadStream<J> pause() { synchronized (this) { paused = true; } return this; }
Example #27
Source File: MQTTSocket.java From vertx-mqtt-broker with Apache License 2.0 | 5 votes |
protected void sendMessageToClient(Buffer bytes, WriteStream<Buffer> writer, ReadStream<Buffer> reader) { try { writer.write(bytes); if (writer.writeQueueFull()) { reader.pause(); writer.drainHandler( done -> reader.resume() ); } } catch(Throwable e) { logger.error(e.getMessage()); } }
Example #28
Source File: MongoClientImpl.java From vertx-mongo-client with Apache License 2.0 | 5 votes |
@Override public ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize) { try { DistinctPublisher<?> distinctValuesWithQuery = findDistinctValuesWithQuery(collection, fieldName, resultClassname, query); PublisherAdapter<?> readStream = new PublisherAdapter<>(vertx.getOrCreateContext(), distinctValuesWithQuery, batchSize); return new MappingStream<>(readStream, value -> new JsonObject().put(fieldName, value)); } catch (ClassNotFoundException e) { return new FailedStream(e); } }
Example #29
Source File: SocketWrapper.java From vertx-mqtt-broker with Apache License 2.0 | 5 votes |
public SocketWrapper(WriteStream<Buffer> w, ReadStream<Buffer> r) { if(w==null) throw new IllegalArgumentException("SocketWrapper: write stream cannot be null"); if(r==null) throw new IllegalArgumentException("SocketWrapper: read stream cannot be null"); this.w = w; this.r = r; }
Example #30
Source File: ConfigurationStreamTest.java From vertx-config with Apache License 2.0 | 5 votes |
@Test public void testFetch(TestContext tc) { retriever = ConfigRetriever.create(vertx, addStores(new ConfigRetrieverOptions().setScanPeriod(500))); Async async = tc.async(); AtomicInteger steps = new AtomicInteger(); ReadStream<JsonObject> stream = retriever.configStream(); stream.pause(); stream.fetch(3); AtomicBoolean paused = new AtomicBoolean(); stream .handler(conf -> { String foo = conf.getString("foo"); tc.assertFalse(paused.get()); int step = steps.getAndIncrement(); if (step == 0) { tc.assertEquals(foo, "bar"); } else { tc.assertEquals(foo, "bar" + step); } if (step < 2) { } else if (step < 6) { paused.set(true); vertx.setTimer(1000, id -> { paused.set(false); stream.fetch(1); }); } else { async.complete(); } System.setProperty("foo", "bar" + (step + 1)); }); }