forked from quarkusio/quarkus-quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#983 from cescoffier/build-time-wiring-si…
…mpliciation Simplify configuration allowed by the build time wiring of reactive messaging
- Loading branch information
Showing
13 changed files
with
110 additions
and
53 deletions.
There are no files selected for viewing
6 changes: 1 addition & 5 deletions
6
amqp-quickstart/amqp-quickstart-processor/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
# Configure the incoming AMQP queue `quote-requests` | ||
mp.messaging.incoming.requests.connector=smallrye-amqp | ||
# Set the AMQP address for the `requests` channel, as it's not the channel name | ||
mp.messaging.incoming.requests.address=quote-requests | ||
|
||
# Configure the outgoing AMQP queue `quotes` | ||
mp.messaging.outgoing.quotes.connector=smallrye-amqp |
50 changes: 50 additions & 0 deletions
50
...t/amqp-quickstart-processor/src/test/java/org/acme/amqp/processor/QuoteProcessorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.acme.amqp.processor; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.UUID; | ||
|
||
import io.smallrye.mutiny.helpers.test.AssertSubscriber; | ||
import io.vertx.amqp.AmqpClientOptions; | ||
import io.vertx.mutiny.amqp.AmqpClient; | ||
import io.vertx.mutiny.amqp.AmqpConnection; | ||
import io.vertx.mutiny.amqp.AmqpMessage; | ||
import io.vertx.mutiny.amqp.AmqpReceiver; | ||
import io.vertx.mutiny.amqp.AmqpSender; | ||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class QuoteProcessorTest { | ||
|
||
@ConfigProperty(name = "amqp-host") String host; | ||
@ConfigProperty(name = "amqp-port") int port; | ||
private AmqpClient client; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
client = AmqpClient.create(new AmqpClientOptions().setHost(host).setPort(port)); | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
client.closeAndAwait(); | ||
} | ||
|
||
@Test | ||
void testProcessor() { | ||
AmqpConnection connection = client.connectAndAwait(); | ||
AmqpReceiver quotes = connection.createReceiverAndAwait("quotes"); | ||
AssertSubscriber<AmqpMessage> subscriber = quotes.toMulti().subscribe().withSubscriber(AssertSubscriber.create(Long.MAX_VALUE)); | ||
AmqpSender sender = connection.createSenderAndAwait("quote-requests"); | ||
UUID quoteId = UUID.randomUUID(); | ||
sender.sendWithAckAndAwait(AmqpMessage.create().address("quote-requests").withBody(quoteId.toString()).build()); | ||
subscriber.awaitItems(1); | ||
AmqpMessage received = subscriber.getItems().get(0); | ||
assertEquals(received.bodyAsJsonObject().getString("id"), quoteId.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
amqp-quickstart/amqp-quickstart-producer/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +0,0 @@ | ||
# Configure the outgoing `quote-requests` queue | ||
mp.messaging.outgoing.quote-requests.connector=smallrye-amqp | ||
|
||
# Configure the incoming `quotes` queue | ||
mp.messaging.incoming.quotes.connector=smallrye-amqp | ||
9 changes: 9 additions & 0 deletions
9
...start/amqp-quickstart-producer/src/test/java/org/acme/amqp/producer/QuotesResourceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.acme.amqp.producer; | ||
|
||
|
||
import io.quarkus.test.junit.NativeImageTest; | ||
|
||
@NativeImageTest | ||
public class QuotesResourceIT extends QuotesResourceTest { | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...art/amqp-quickstart-producer/src/test/java/org/acme/amqp/producer/QuotesResourceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.acme.amqp.producer; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
|
||
import java.util.UUID; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class QuotesResourceTest { | ||
|
||
@Test | ||
void testQuotesEventStream() { | ||
String body = given() | ||
.when() | ||
.post("/quotes/request") | ||
.then() | ||
.statusCode(200) | ||
.extract().body() | ||
.asString(); | ||
assertDoesNotThrow(() -> UUID.fromString(body)); | ||
} | ||
} |
21 changes: 4 additions & 17 deletions
21
kafka-avro-schema-quickstart/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
# set the connector for the outgoing channel to `smallrye-kafka` | ||
mp.messaging.outgoing.movies.connector=smallrye-kafka | ||
|
||
# set the topic name for the channel to `movies` | ||
mp.messaging.outgoing.movies.topic=movies | ||
|
||
# automatically register the schema with the registry, if not present | ||
mp.messaging.outgoing.movies.apicurio.registry.auto-register=true | ||
|
||
# set the connector for the incoming channel to `smallrye-kafka` | ||
mp.messaging.incoming.movies-from-kafka.connector=smallrye-kafka | ||
kafka.apicurio.registry.auto-register=true | ||
kafka.auto.offset.reset=earliest | ||
|
||
# set the topic name for the channel to `movies` | ||
# set the topic name for the incoming channel to `movies`, as it's not the channel name | ||
mp.messaging.incoming.movies-from-kafka.topic=movies | ||
|
||
# disable auto-commit, Reactive Messaging handles it itself | ||
mp.messaging.incoming.movies-from-kafka.enable.auto.commit=false | ||
|
||
mp.messaging.incoming.movies-from-kafka.auto.offset.reset=earliest | ||
|
||
%prod.mp.messaging.connector.smallrye-kafka.apicurio.registry.url=http://localhost:8081/apis/registry/v2 | ||
%prod.kafka.apicurio.registry.url=http://localhost:8081/apis/registry/v2 |
4 changes: 0 additions & 4 deletions
4
kafka-panache-quickstart/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
kafka-panache-reactive-quickstart/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
kafka-quickstart/processor/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
%dev.quarkus.http.port=8081 | ||
|
||
# Configure the incoming `quote-requests` Kafka topic | ||
mp.messaging.incoming.requests.connector=smallrye-kafka | ||
# Go bad to the first records, if it's out first access | ||
kafka.auto.offset.reset=earliest | ||
|
||
# Set the Kafka topic, as it's not the channel name | ||
mp.messaging.incoming.requests.topic=quote-requests | ||
mp.messaging.incoming.requests.auto.offset.reset=earliest | ||
|
||
|
||
# Configure the outgoing `quotes` Kafka topic | ||
mp.messaging.outgoing.quotes.connector=smallrye-kafka | ||
mp.messaging.outgoing.quotes.value.serializer=io.quarkus.kafka.client.serialization.ObjectMapperSerializer |
5 changes: 0 additions & 5 deletions
5
kafka-quickstart/producer/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +0,0 @@ | ||
# Configure the outgoing `quote-requests` Kafka topic | ||
mp.messaging.outgoing.quote-requests.connector=smallrye-kafka | ||
|
||
# Configure the incoming `quotes` Kafka topic | ||
mp.messaging.incoming.quotes.connector=smallrye-kafka | ||
9 changes: 9 additions & 0 deletions
9
kafka-quickstart/producer/src/test/java/org/acme/kafka/producer/QuotesResourceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.acme.kafka.producer; | ||
|
||
|
||
import io.quarkus.test.junit.NativeImageTest; | ||
|
||
@NativeImageTest | ||
public class QuotesResourceIT extends QuotesResourceTest { | ||
|
||
} |