Wait for data

This commit is contained in:
David Turanski
2020-08-13 15:01:31 -04:00
parent 52bb359609
commit 4acf224790
3 changed files with 14 additions and 3 deletions

View File

@@ -46,8 +46,9 @@ The **$$http-request$$** $$processor$$ has the following options:
$$http.request.body-expression$$:: $$A SpEL expression to derive the request body from the incoming message.$$ *($$Expression$$, default: `$$<none>$$`)*
$$http.request.expected-response-type$$:: $$The type used to interpret the response.$$ *($$Class<?>$$, default: `$$<none>$$`)*
$$http.request.headers-expression$$:: $$A SpEL expression used to derive the http headers map to use.$$ *($$Expression$$, default: `$$<none>$$`)*
$$http.request.http-method-expression$$:: $$A SpEL expression to derive the request method from the incoming message.$$ *($$Expression$$, default: `$$'GET'$$`)*
$$http.request.reply-expression$$:: $$A SpEL expression used to compute the final result, applied against the whole http {@link org.springframework.http.ResponseEntity}.$$ *($$Expression$$, default: `$$body$$`)*
$$http.request.http-method-expression$$:: $$A SpEL expression to derive the request method from the incoming message.$$ *($$Expression$$, default: `$$<none>$$`)*
$$http.request.maximum-buffer-size$$:: $$Maximum buffer size in bytes allocated for input stream buffers. Defaults to 256k. Increase, as necessary, for posting or getting large binary content.$$ *($$Integer$$, default: `$$0$$`)*
$$http.request.reply-expression$$:: $$A SpEL expression used to compute the final result, applied against the whole http {@link org.springframework.http.ResponseEntity}.$$ *($$Expression$$, default: `$$<none>$$`)*
$$http.request.timeout$$:: $$Request timeout in milliseconds.$$ *($$Long$$, default: `$$30000$$`)*
$$http.request.url-expression$$:: $$A SpEL expression against incoming message to determine the URL to use.$$ *($$Expression$$, default: `$$<none>$$`)*
//end::configuration-properties[]

View File

@@ -48,6 +48,11 @@
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>

View File

@@ -35,6 +35,7 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
/**
* @author David Turanski
@@ -70,7 +71,11 @@ class MongoDbConsumerApplicationTests {
messages.map(message -> {
mongodbConsumer.accept(message);
return message;
}).blockLast(Duration.ofSeconds(30));
}).subscribe();
await().timeout(Duration.ofSeconds(10))
.until(() -> mongoTemplate.findAll(Document.class, properties.getCollection()).count().block() == 3L);
StepVerifier.create(this.mongoTemplate.findAll(Document.class, properties.getCollection())
.sort(Comparator.comparing(d -> d.get("_id").toString())))