Improve code examples in docs

* Use tabs attribute for code example
* Add missed method name for listener container bean definition example

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
This commit is contained in:
Tran Ngoc Nhan
2025-06-02 21:27:18 +07:00
committed by GitHub
parent 201a6f620e
commit 52a5e8ccdd
4 changed files with 24 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ The following example shows how to do so in XML and in Java (for both a `SimpleM
[source, java]
----
@Bean
public SimpleMessageListenerContainer(ConnectionFactory connectionFactory) {
public SimpleMessageListenerContainer smlc(ConnectionFactory connectionFactory) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
...
container.setIdleEventInterval(60000L);

View File

@@ -315,8 +315,12 @@ You can add custom client properties by adding either string properties or more
Each appender supports adding client properties to the RabbitMQ connection.
The following example shows how to add a custom client property for logback:
The following example shows how to add a custom client property:
[tabs]
======
logback::
+
[source, xml]
----
<appender name="AMQP" ...>
@@ -326,7 +330,8 @@ The following example shows how to add a custom client property for logback:
</appender>
----
.log4j2
log4j2::
+
[source, xml]
----
<Appenders>
@@ -338,6 +343,7 @@ The following example shows how to add a custom client property for logback:
</RabbitMQ>
</Appenders>
----
======
The properties are a comma-delimited list of `key:value` pairs.
Keys and values cannot contain commas or colons.

View File

@@ -9,7 +9,10 @@ For that purpose a https://qpid.apache.org/components/jms/index.html[JMS bridge]
This dependency has to be added to the project to be able to interact with RabbitMQ AMQP 1.0 support:
.maven
[tabs]
======
Maven::
+
[source,xml,subs="+attributes"]
----
<dependency>
@@ -19,11 +22,13 @@ This dependency has to be added to the project to be able to interact with Rabbi
</dependency>
----
.gradle
Gradle::
+
[source,groovy,subs="+attributes"]
----
compile 'org.springframework.amqp:spring-rabbitmq-client:{project-version}'
----
======
The `spring-rabbit` (for AMQP 0.9.1 protocol) comes as a transitive dependency for reusing some common API in this new client, for example, exceptions, the `@RabbitListener` support.
It is not necessary to use both functionality in the target project, but RabbitMQ allows both AMQP 0.9.1 and 1.0 co-exists.

View File

@@ -8,7 +8,10 @@ Version 2.4 introduces initial support for the {rabbitmq-github}/rabbitmq-stream
Add the `spring-rabbit-stream` dependency to your project:
.maven
[tabs]
======
Maven::
+
[source,xml,subs="+attributes"]
----
<dependency>
@@ -18,11 +21,13 @@ Add the `spring-rabbit-stream` dependency to your project:
</dependency>
----
.gradle
Gradle::
+
[source,groovy,subs="+attributes"]
----
compile 'org.springframework.amqp:spring-rabbit-stream:{project-version}'
----
======
You can provision the queues as normal, using a `RabbitAdmin` bean, using the `QueueBuilder.stream()` method to designate the queue type.
For example:
@@ -97,7 +102,7 @@ public void setMessageConverter(MessageConverter messageConverter) {
public void setStreamConverter(StreamMessageConverter streamConverter) {
}
public synchronized void setProducerCustomizer(ProducerCustomizer producerCustomizer) {
public void setProducerCustomizer(ProducerCustomizer producerCustomizer) {
}
----