Class AceMqAutoConfiguration
acemq.*.
What an application gets: an AceMq connection, the codec named by
acemq.format, telemetry through Micrometer when a registry is present, the
declared topology applied once, and AceListener methods consuming.
The health indicator is not here. It lives in acemq-spring-boot-health-boot3
and acemq-spring-boot-health-boot4, one per Spring Boot line, because Boot 4
moved the health contributor API to a different package in a different artifact. Both are
on the classpath when the starter is used, and exactly one of them ever matches. This
module itself compiles and runs unchanged on both lines.
Every bean is @ConditionalOnMissingBean. Defining your own AceMq bean
-- two connections, a transport this starter does not know about, a wrapper -- replaces
the one here and keeps the listeners, the topology and the health indicator, because those
take the connection as a dependency rather than creating it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTelemetry through Micrometer, which is how the library's metrics reach whatever the application already exports to.static classTelemetry without Micrometer: whatever the library can detect, which finds OpenTelemetry if it is there and is otherwise a no-op. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaceListenerAnnotationBeanPostProcessor(org.springframework.beans.factory.ObjectProvider<AceListenerRegistry> registry, AceMqProperties properties) The post-processor that findsAceListenermethods.aceListenerRegistry(org.acemq.amqp.core.AceMq aceMq, AceMqProperties properties) The listener registry, which starts and stops the annotated methods.org.acemq.amqp.core.AceMqaceMq(org.acemq.amqp.transport.ConnectionConfig config, org.acemq.amqp.api.Telemetry telemetry, org.acemq.amqp.api.Codec codec) The connection.org.acemq.amqp.api.CodecaceMqCodec(AceMqProperties properties) The default codec.org.acemq.amqp.transport.ConnectionConfigaceMqConnectionConfig(AceMqProperties properties, AceMqConnectionDetails details, org.springframework.core.env.Environment environment) The connection configuration, separately from the connection, so an application can see and override it without taking over connecting.aceMqConnectionDetails(AceMqProperties properties) Where the broker is, read fromacemq.*.aceMqTopologyInitializer(org.acemq.amqp.core.AceMq aceMq, AceMqProperties properties) Applies the declared topology.
-
Constructor Details
-
AceMqAutoConfiguration
public AceMqAutoConfiguration()
-
-
Method Details
-
aceMqConnectionDetails
@Bean @ConditionalOnMissingBean(AceMqConnectionDetails.class) public AceMqConnectionDetails aceMqConnectionDetails(AceMqProperties properties) Where the broker is, read fromacemq.*. Docker Compose and a Testcontainers@ServiceConnectioneach register their own bean of this type, which replaces this one.- Parameters:
properties- theacemq.*configuration- Returns:
- the details
-
aceMqConnectionConfig
@Bean @ConditionalOnMissingBean public org.acemq.amqp.transport.ConnectionConfig aceMqConnectionConfig(AceMqProperties properties, AceMqConnectionDetails details, org.springframework.core.env.Environment environment) The connection configuration, separately from the connection, so an application can see and override it without taking over connecting.- Parameters:
properties- theacemq.*configurationdetails- where the broker isenvironment- used only forspring.application.name- Returns:
- the configuration
-
aceMqCodec
@Bean @ConditionalOnMissingBean public org.acemq.amqp.api.Codec aceMqCodec(AceMqProperties properties) The default codec.- Parameters:
properties- theacemq.*configuration- Returns:
- the codec named by
acemq.format
-
aceMq
@Bean(destroyMethod="close") @ConditionalOnMissingBean public org.acemq.amqp.core.AceMq aceMq(org.acemq.amqp.transport.ConnectionConfig config, org.acemq.amqp.api.Telemetry telemetry, org.acemq.amqp.api.Codec codec) The connection.destroyMethodcloses it: the context owns the connection, and an application that has to remember to close it will forget in exactly the tests that create a context per class.- Parameters:
config- the connection configurationtelemetry- telemetrycodec- the default codec- Returns:
- the connection
-
aceMqTopologyInitializer
@Bean @ConditionalOnMissingBean public AceMqTopologyInitializer aceMqTopologyInitializer(org.acemq.amqp.core.AceMq aceMq, AceMqProperties properties) Applies the declared topology. Does nothing when nothing is declared.The bean exists either way rather than hiding behind a condition on the properties: a list under
acemq.topology.queuesis bound as indexed keys, which@ConditionalOnPropertycannot see, so the condition would be wrong in the one direction that matters -- silently skipping a topology somebody declared.- Parameters:
aceMq- the connectionproperties- theacemq.*configuration- Returns:
- the initializer
-
aceListenerRegistry
@Bean @ConditionalOnMissingBean public AceListenerRegistry aceListenerRegistry(org.acemq.amqp.core.AceMq aceMq, AceMqProperties properties) The listener registry, which starts and stops the annotated methods.It is handed the declared topology and its apply mode. Queues under
acemq.topology.queuesare not asked about, because the topology is applied before any listener starts and invalidatemode a missing one has already failed the startup; a dry run creates nothing, so then every queue is asked about. A listener that declares its own queue declares it in the same mode, and has to agree with the topology when both declare it.- Parameters:
aceMq- the connectionproperties- theacemq.*configuration- Returns:
- the registry
-
aceListenerAnnotationBeanPostProcessor
@Bean @ConditionalOnMissingBean public static AceListenerAnnotationBeanPostProcessor aceListenerAnnotationBeanPostProcessor(org.springframework.beans.factory.ObjectProvider<AceListenerRegistry> registry, AceMqProperties properties) The post-processor that findsAceListenermethods.Static, which Spring requires of a
BeanPostProcessorfactory method: a non-static one would instantiate this configuration class -- and with it the connection -- before post-processing began.- Parameters:
registry- the registry to register endpoints with, resolved lazilyproperties- theacemq.*configuration- Returns:
- the post-processor
-