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

Improve Java DSL for Rabbit Streams #8598

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

artembilan
Copy link
Member

  • Expose simple properties for streamName and superStream on the RabbitStreamInboundChannelAdapterSpec
  • Add superStream(String superStream, String name, int consumers) option
  • Add outboundStreamAdapter(Environment environment, String streamName) factory for simple use-cases
  • Add RabbitStreamTests integration test to cover Rabbit Streams support and demonstrate respective Java DSL
  • Mention the change in the docs

* Expose simple properties for `streamName` and `superStream`
on the `RabbitStreamInboundChannelAdapterSpec`
* Add `superStream(String superStream, String name, int consumers)` option
* Add `outboundStreamAdapter(Environment environment, String streamName)` factory for
simple use-cases
* Add `RabbitStreamTests` integration test to cover Rabbit Streams support
 and demonstrate respective Java DSL
* Mention the change in the docs
@@ -1426,7 +1426,7 @@ image::images/spring-integration-amqp-sample-graph.png[align="center"]

Version 6.0 introduced support for RabbitMQ Stream Queues.

The DSL factory class for these endpoints is `Rabbit`.
The DSL factory class for these endpoints is a `RabbitStream`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The DSL factory class for these endpoints is a `RabbitStream`.
The DSL factory class for these endpoints is `RabbitStream`.

Comment on lines 58 to 77
/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superName(String superStream, String consumerName) {
return superName(superStream, consumerName, 1);
}

/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @param consumers the number of consumers.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superName(String superStream, String consumerName, int consumers) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs say this is superStream (which I think is better).

Suggested change
/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superName(String superStream, String consumerName) {
return superName(superStream, consumerName, 1);
}
/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @param consumers the number of consumers.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superName(String superStream, String consumerName, int consumers) {
/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superStream(String superStream, String consumerName) {
return superStream(superStream, consumerName, 1);
}
/**
* Configure a name for Rabbit super stream to consume from.
* @param superStream the name of Rabbit super stream.
* @param consumerName the logical name to enable offset tracking.
* @param consumers the number of consumers.
* @return the spec
* @since 6.1
*/
public RabbitStreamInboundChannelAdapterSpec superStream(String superStream, String consumerName, int consumers) {

IntegrationFlow superStreamConsumer(Environment env) {
return IntegrationFlow.from(
RabbitStream.inboundAdapter(env)
.superName("test.superStream1", "mySuperConsumer"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.superName("test.superStream1", "mySuperConsumer"))
.superStream("test.superStream1", "mySuperConsumer"))

src/reference/asciidoc/amqp.adoc Show resolved Hide resolved
@garyrussell garyrussell merged commit feb4705 into spring-projects:main Apr 18, 2023
@artembilan artembilan deleted the Improve_RabbitStream_DSL branch April 18, 2023 15:29
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.

2 participants