Skip to content

Commit 66e935f

Browse files
committed
Fix graphql.adoc and optimize Debezium tests
* Fix some typos and update to the actual types in the `graphql.adoc` * Don't use `@Container` in the `DebeziumMySqlTestContainer`, but rather start it manually in the `@BeforeAll` and let one container to survive between tests. The Ryuk container then takes care about other containers on JVM exist
1 parent 4db9bad commit 66e935f

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

spring-integration-debezium/src/test/java/org/springframework/integration/debezium/DebeziumMySqlTestContainer.java

+13-8
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import java.util.Properties;
2020
import java.util.UUID;
2121

22+
import org.junit.jupiter.api.BeforeAll;
2223
import org.testcontainers.containers.GenericContainer;
2324
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
24-
import org.testcontainers.junit.jupiter.Container;
2525
import org.testcontainers.junit.jupiter.Testcontainers;
2626

2727
/**
@@ -35,13 +35,18 @@ public interface DebeziumMySqlTestContainer {
3535

3636
int EXPECTED_DB_TX_COUNT = 52;
3737

38-
@Container
39-
GenericContainer<?> DEBEZIUM_MYSQL = new GenericContainer<>("debezium/example-mysql:2.2.0.Final")
40-
.withExposedPorts(3306)
41-
.withEnv("MYSQL_ROOT_PASSWORD", "debezium")
42-
.withEnv("MYSQL_USER", "mysqluser")
43-
.withEnv("MYSQL_PASSWORD", "mysqlpw")
44-
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*port: 3306 MySQL Community Server - GPL.*."));
38+
GenericContainer<?> DEBEZIUM_MYSQL =
39+
new GenericContainer<>("debezium/example-mysql:2.2.0.Final")
40+
.withExposedPorts(3306)
41+
.withEnv("MYSQL_ROOT_PASSWORD", "debezium")
42+
.withEnv("MYSQL_USER", "mysqluser")
43+
.withEnv("MYSQL_PASSWORD", "mysqlpw")
44+
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*port: 3306 MySQL Community Server - GPL.*."));
45+
46+
@BeforeAll
47+
static void startContainer() {
48+
DEBEZIUM_MYSQL.start();
49+
}
4550

4651
static int mysqlPort() {
4752
return DEBEZIUM_MYSQL.getMappedPort(3306);

src/reference/asciidoc/graphql.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ compile "org.springframework.integration:spring-integration-graphql:{project-ver
2727
=== GraphQL Outbound Gateway
2828

2929
The `GraphQlMessageHandler` is an `AbstractReplyProducingMessageHandler` extension representing an outbound gateway contract to perform GraphQL `query`, `mutation` or `subscription` operation and produce their result.
30-
It requires a `org.springframework.graphql.ExecutionGraphQlService` for execution of `operation`, which can be configured statically or via SpEL expression against a request message.
30+
It requires a `org.springframework.graphql.ExecutionGraphQlService` for execution of an `operation`, which can be configured statically or via SpEL expression against a request message.
3131
The `operationName` is optional and also can be configured statically or via SpEL expression.
3232
The `variablesExpression` is also optional and used for parametrized operations.
3333
The `locale` is optional and used for operation execution context in the https://www.graphql-java.com/[GraphQL Java] library.
3434
The `executionId` can be configured via SpEL expression and defaults to `id` header of the request message.
3535

36-
If the payload of request message is an instance of `ExecutionGraphQlRequest`, then there's no any setup actions are performed in the `GraphQlMessageHandler` and such an input is used as is for the `ExecutionGraphQlService.execute()`.
36+
If the payload of the request message is an instance of `ExecutionGraphQlRequest`, then there's no any setup actions are performed in the `GraphQlMessageHandler` and such an input is used as is for the `ExecutionGraphQlService.execute()`.
3737
Otherwise, the `operation`, `operationName`, `variables` and `executionId` are determined against request message using SpEL expressions mentioned above.
3838

3939
The `GraphQlMessageHandler` is a reactive streams component and produces a `Mono<ExecutionGraphQlResponse>` reply as a result of the `ExecutionGraphQlService.execute(ExecutionGraphQlRequest)`.
@@ -87,15 +87,15 @@ AnnotatedControllerConfigurer annotatedDataFetcherConfigurer() {
8787
====
8888

8989
The special treatment should be applied for the result of a subscription operation.
90-
In this case the `RequestOutput.getData()` returns a `SubscriptionPublisher` which has to subscribed and processed manually.
90+
In this case the `ExecutionGraphQlResponse.getData()` returns a `SubscriptionPublisher` which has to subscribed and processed manually.
9191
Or it can be flat-mapped via plain service activator to the reply for the `FluxMessageChannel`:
9292

9393
====
9494
[source, java]
9595
----
9696
@ServiceActivator(inputChannel = "graphQlResultChannel", outputChannel="graphQlSubscriptionChannel")
97-
public SubscriptionPublisher obtainSubscriptionResult(RequestOutput output) {
98-
return output.getData(0);
97+
public SubscriptionPublisher obtainSubscriptionResult(ExecutionGraphQlResponse graphQlResponse) {
98+
return graphQlResponse.getData();
9999
}
100100
----
101101
====

0 commit comments

Comments
 (0)