Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started guide for smallrye-reactive-messaging-kafka #17830

Merged

Conversation

ozangunalp
Copy link
Contributor

The kafka.adoc will be renamed to Kafka reference guide

@cescoffier
Copy link
Member

With Dev Services, I'm wondering if we should not split the app in two different processes. That would be way more realistic.

@ozangunalp ozangunalp force-pushed the kafka-reactive-getting-started branch from c69eeea to e4251f8 Compare June 22, 2021 08:21
@ozangunalp ozangunalp force-pushed the kafka-reactive-getting-started branch from e4251f8 to 34afbda Compare July 1, 2021 07:52
@ozangunalp ozangunalp changed the title WIP Simple getting started guide for smallrye-reactive-messaging-kafka Getting started guide for smallrye-reactive-messaging-kafka Jul 2, 2021
@ozangunalp ozangunalp marked this pull request as ready for review July 2, 2021 16:53
Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does <> cross page boundary? I always used xref in that case.


== Architecture

In this guide, we are going to develop two microservices for an application that will ask for some price and receive quotes from providers in real-time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this guide, we are going to develop two microservices for an application that will ask for some price and receive quotes from providers in real-time.
In this guide, we are going to develop two applications communicating with Kafka.
The first application sends a _quote request_ to Kafka and consumes Kafka messages from the _quote_ topic.
The second application receives the _quote request_ and sends a _quote_ back.
  • add picture


In this guide, we are going to develop two microservices for an application that will ask for some price and receive quotes from providers in real-time.

The first component, the `producer`, will let the user request some quotes over a JAX-RS endpoint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The first component, the `producer`, will let the user request some quotes over a JAX-RS endpoint.
The first component, the `producer`, will let the user request some quotes over an HTTP endpoint.

For each quote request a random identifier is generated and returned to the user, to put the quote request on _pending_.
At the same time the generated request id is sent over a Kafka topic `quote-requests`.

The second component, the `processor`, in turn will read from the `quote-requests` topic put a magic random price to the quote and send it to a Kafka topic named `quotes`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The second component, the `processor`, in turn will read from the `quote-requests` topic put a magic random price to the quote and send it to a Kafka topic named `quotes`.
The second component, the `processor`, in turn, will read from the `quote-requests` topic put a random price to the quote, and send it to a Kafka topic named `quotes`.

import io.smallrye.mutiny.Multi;
[...]

@Inject
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Inject can be ommited.

----

Nothing spectacular here.
On each received price, it updates the page.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On each received price, it updates the page.
On each received quote, it updates the page.

Quarkus starts a Kafka broker automatically, configures the application and shares the Kafka broker instance between different applications.
See xref:kafka-dev-services.adoc[Dev Services for Kafka] for more details.

Open `http://localhost:8080/quotes.html` in your browser.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Open `http://localhost:8080/quotes.html` in your browser.
Open `http://localhost:8080/quotes.html` in your browser and click the button to request quotes.

This guide has shown how you can interact with Kafka using Quarkus.
It utilizes SmallRye Reactive Messaging to build data streaming applications.

If you want to go further check the documentation of https://smallrye.io/smallrye-reactive-messaging[SmallRye Reactive Messaging], the implementation used in Quarkus.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you want to go further check the documentation of https://smallrye.io/smallrye-reactive-messaging[SmallRye Reactive Messaging], the implementation used in Quarkus.
If you want to go further check the documentation of https://smallrye.io/smallrye-reactive-messaging[SmallRye Reactive Messaging].

@cescoffier cescoffier merged commit 3855630 into quarkusio:main Jul 9, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jul 9, 2021
@ozangunalp ozangunalp deleted the kafka-reactive-getting-started branch July 9, 2021 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants