Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ antora {
}

tasks.named('generateAntoraYml') {
asciidocAttributes = project.provider({
return ['project-version': project.version]
})
asciidocAttributes = project.provider( { generateAttributes() } )
baseAntoraYmlFile = file('src/reference/antora/antora.yml')
}

Expand Down Expand Up @@ -724,3 +722,24 @@ publishing {
}
}
}

def generateAttributes() {
def springDocs = "https://docs.spring.io"
def micrometerDocsPrefix = "https://docs.micrometer.io"

return [
'project-version': project.version,
'spring-integration-docs': "$springDocs/spring-integration/reference".toString(),
'spring-framework-docs': "$springDocs/spring-framework/reference/${generateVersionWithoutPatch(springVersion)}".toString(),
'spring-retry-java-docs': "$springDocs/spring-retry/docs/$springRetryVersion/apidocs".toString(),
'javadoc-location-org-springframework-transaction': "$springDocs/spring-framework/docs/$springVersion/javadoc-api".toString(),
'javadoc-location-org-springframework-amqp': "$springDocs/spring-amqp/docs/$project.version/api".toString(),
'micrometer-docs': "$micrometerDocsPrefix/micrometer/reference/${generateVersionWithoutPatch(micrometerVersion)}".toString(),
'micrometer-tracing-docs': "$micrometerDocsPrefix/tracing/reference/${generateVersionWithoutPatch(micrometerTracingVersion)}".toString()
]
}

static String generateVersionWithoutPatch(String version) {

return version.split('\\.')[0,1].join('.') + (version.endsWith('-SNAPSHOT') ? '-SNAPSHOT' : '')
}
1 change: 1 addition & 0 deletions src/reference/antora/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ asciidoc:
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
- '@springio/asciidoctor-extensions/javadoc-extension'
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we have to contribute this one to the build-all docs branch: https://github.com/spring-projects/spring-amqp/blob/docs-build/antora-playbook.yml#L28

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line use for prefix javadoc: when generating document

The reference:
https://github.com/spring-io/asciidoctor-extensions?tab=readme-ov-file#javadoc

I think it will be easier when we use javadoc links in document instead prefix {spring-amqp-java-docs}

sourcemap: true
urls:
latest_version_segment: ''
Expand Down
11 changes: 1 addition & 10 deletions src/reference/antora/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ asciidoc:
attributes:
attribute-missing: 'warn'
chomp: 'all'
spring-docs: 'https://docs.spring.io'
spring-framework-docs: '{spring-docs}/spring-framework/reference'
spring-integration-docs: '{spring-docs}/spring-integration/reference'
spring-amqp-java-docs: '{spring-docs}/spring-amqp/docs/current/api/org/springframework/amqp'
spring-framework-java-docs: '{spring-docs}/spring/docs/current/javadoc-api/org/springframework'
spring-retry-java-docs: '{spring-docs}/spring-retry/docs/api/current/'
# External projects URLs and related attributes
micrometer-docs: 'https://docs.micrometer.io'
micrometer-tracing-docs: '{micrometer-docs}/tracing/reference/'
micrometer-micrometer-docs: '{micrometer-docs}/micrometer/reference/'
rabbitmq-stream-docs: 'https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle'
rabbitmq-github: 'https://github.com/rabbitmq'
rabbitmq-server-github: '{rabbitmq-github}/rabbitmq-server/tree/main/deps'
rabbitmq-server-github: '{rabbitmq-github}/rabbitmq-server/tree/main/deps'
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public Exchange exchange() {
}
----

See the Javadoc for {spring-amqp-java-docs}/core/QueueBuilder.html[`org.springframework.amqp.core.QueueBuilder`] and {spring-amqp-java-docs}/core/ExchangeBuilder.html[`org.springframework.amqp.core.ExchangeBuilder`] for more information.
See the Javadoc for javadoc:org.springframework.amqp.core.QueueBuilder[`org.springframework.amqp.core.QueueBuilder`] and javadoc:org.springframework.amqp.core.ExchangeBuilder[`org.springframework.amqp.core.ExchangeBuilder`] for more information.

Starting with version 2.0, the `ExchangeBuilder` now creates durable exchanges by default, to be consistent with the simple constructors on the individual `AbstractExchange` classes.
To make a non-durable exchange with the builder, use `.durable(false)` before invoking `.build()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public class MyService {
----

It is important to unbind the resource after use.
For more information, see the {spring-amqp-java-docs}/rabbit/connection/AbstractRoutingConnectionFactory.html[JavaDoc] for `AbstractRoutingConnectionFactory`.
For more information, see the javadoc:org.springframework.amqp.rabbit.connection.AbstractRoutingConnectionFactory[JavaDoc] for `AbstractRoutingConnectionFactory`.

Starting with version 1.4, `RabbitTemplate` supports the SpEL `sendConnectionFactorySelectorExpression` and `receiveConnectionFactorySelectorExpression` properties, which are evaluated on each AMQP protocol interaction operation (`send`, `sendAndReceive`, `receive`, or `receiveAndReply`), resolving to a `lookupKey` value for the provided `AbstractRoutingConnectionFactory`.
You can use bean references, such as `@vHostResolver.getVHost(#root)` in the expression.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Container can be initially configured to listen on zero queues.
Queues can be added and removed at runtime.
The `SimpleMessageListenerContainer` recycles (cancels and re-creates) all consumers when any pre-fetched messages have been processed.
The `DirectMessageListenerContainer` creates/cancels individual consumer(s) for each queue without affecting consumers on other queues.
See the {spring-amqp-java-docs}/rabbit/listener/AbstractMessageListenerContainer.html[Javadoc] for the `addQueues`, `addQueueNames`, `removeQueues` and `removeQueueNames` methods.
See the javadoc:org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer[Javadoc] for the `addQueues`, `addQueueNames`, `removeQueues` and `removeQueueNames` methods.

If not all queues are available, the container tries to passively declare (and consume from) the missing queues every 60 seconds.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In this case, and ignoring the RabbitMQ infrastructure setup, the `processOrder`

You can customize the listener container factory to use for each annotation, or you can configure an explicit default by implementing the `RabbitListenerConfigurer` interface.
The default is required only if at least one endpoint is registered without a specific container factory.
See the {spring-amqp-java-docs}/rabbit/annotation/RabbitListenerConfigurer.html[Javadoc] for full details and examples.
See the javadoc:org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer[Javadoc] for full details and examples.

The container factories provide methods for adding `MessagePostProcessor` instances that are applied after receiving messages (before invoking the listener) and before sending replies.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
= Micrometer Integration
:page-section-summary-toc: 1

NOTE: This section documents the integration with {micrometer-micrometer-docs}[Micrometer].
NOTE: This section documents the integration with {micrometer-docs}[Micrometer].
For integration with Micrometer Observation, see xref:amqp/receiving-messages/micrometer-observation.adoc[Micrometer Observation].

Starting with version 2.2, the listener containers will automatically create and update Micrometer `Timer` s for the listener, if `Micrometer` is detected on the class path, and a single `MeterRegistry` is present in the application context (or exactly one is annotated `@Primary`, such as when using Spring Boot).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Those methods are quite useful for request-reply scenarios, since they handle th

Similar request-reply methods are also available where the `MessageConverter` is applied to both the request and reply.
Those methods are named `convertSendAndReceive`.
See the {spring-amqp-java-docs}/core/AmqpTemplate.html[Javadoc of `AmqpTemplate`] for more detail.
See the javadoc:org.springframework.amqp.core.AmqpTemplate[Javadoc of `AmqpTemplate`] for more detail.

Starting with version 1.5.0, each of the `sendAndReceive` method variants has an overloaded version that takes `CorrelationData`.
Together with a properly configured connection factory, this enables the receipt of publisher confirms for the send side of the operation.
See xref:amqp/template.adoc#template-confirms[Correlated Publisher Confirms and Returns] and the {spring-amqp-java-docs}/rabbit/core/RabbitOperations.html[Javadoc for `RabbitOperations`] for more information.
See xref:amqp/template.adoc#template-confirms[Correlated Publisher Confirms and Returns] and the javadoc:org.springframework.amqp.rabbit.core.RabbitOperations[Javadoc for `RabbitOperations`] for more information.

Starting with version 2.0, there are variants of these methods (`convertSendAndReceiveAsType`) that take an additional `ParameterizedTypeReference` argument to convert complex returned types.
The template must be configured with a `SmartMessageConverter`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Message message = MessageBuilder.withBody("foo".getBytes())
.build();
----

Each of the properties defined on the {spring-amqp-java-docs}/core/MessageProperties.html[`MessageProperties`] can be set.
Each of the properties defined on the javadoc:org.springframework.amqp.core.MessageProperties[] can be set.
Other methods include `setHeader(String key, String value)`, `removeHeader(String key)`, `removeHeaders()`, and `copyProperties(MessageProperties properties)`.
Each property setting method has a `set*IfAbsent()` variant.
In the cases where a default initial value exists, the method is named `set*IfAbsentOrDefault()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ See xref:amqp/containerAttributes.adoc[Message Listener Container Configuration]
[[using-rabbittransactionmanager]]
== Using `RabbitTransactionManager`

The {spring-amqp-java-docs}/rabbit/transaction/RabbitTransactionManager.html[RabbitTransactionManager] is an alternative to executing Rabbit operations within, and synchronized with, external transactions.
This transaction manager is an implementation of the {spring-framework-java-docs}/transaction/PlatformTransactionManager.html[`PlatformTransactionManager`] interface and should be used with a single Rabbit `ConnectionFactory`.
The javadoc:org.springframework.amqp.rabbit.transaction.RabbitTransactionManager[] is an alternative to executing Rabbit operations within, and synchronized with, external transactions.
This transaction manager is an implementation of the javadoc:org.springframework.transaction.PlatformTransactionManager[] interface and should be used with a single Rabbit `ConnectionFactory`.

IMPORTANT: This strategy is not able to provide XA transactions -- for example, in order to share transactions between messaging and database access.

Application code is required to retrieve the transactional Rabbit resources through `ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactory, boolean)` instead of a standard `Connection.createChannel()` call with subsequent channel creation.
When using Spring AMQP's {spring-amqp-java-docs}/rabbit/core/RabbitTemplate.html[RabbitTemplate], it will autodetect a thread-bound Channel and automatically participate in its transaction.
When using Spring AMQP's javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[], it will autodetect a thread-bound Channel and automatically participate in its transaction.

With Java Configuration, you can setup a new RabbitTransactionManager by using the following bean:

Expand Down
2 changes: 1 addition & 1 deletion src/reference/antora/modules/ROOT/pages/sample-apps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,4 @@ Spring applications, when sending JSON, set the `__TypeId__` header to the fully

The `spring-rabbit-json` sample explores several techniques to convert the JSON from a non-Spring application.

See also xref:amqp/message-converters.adoc#json-message-converter[`Jackson2JsonMessageConverter`] as well as the {spring-amqp-java-docs}/index.html?org/springframework/amqp/support/converter/DefaultClassMapper.html[Javadoc for the `DefaultClassMapper`].
See also xref:amqp/message-converters.adoc#json-message-converter[`Jackson2JsonMessageConverter`] as well as the javadoc:org.springframework.amqp.support.converter.DefaultClassMapper[Javadoc for the `DefaultClassMapper`].