Class EndpointRegistrar
java.lang.Object
io.awspring.cloud.sqs.config.EndpointRegistrar
- All Implemented Interfaces:
Aware,BeanFactoryAware,SmartInitializingSingleton
public class EndpointRegistrar
extends Object
implements BeanFactoryAware, SmartInitializingSingleton
Processes the registered
Endpoint instances using the appropriate MessageListenerContainerFactory.
Contains configurations that will be applied to all @SqsListener
containers. Such configurations can be set by declaring SqsListenerConfigurer beans.- Since:
- 3.0
- Author:
- Tomaz Fernandes
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid@Nullable JacksonMessageConverterMigrationGet the object mapper used to deserialize payloads.Get the message converters list consumer.Return theMessageHandlerMethodFactoryto be used to createMessageHandlerinstances for theEndpoints.Get the method argument resolvers list consumer.@Nullable MethodPayloadTypeInferrerGet theMethodPayloadTypeInferrerused for inferring payload types from listener method signatures.@Nullable ValidatorReturn theValidatorinstance used for payload validating inHandlerMethodArgumentResolverinstances.voidmanageMessageConverters(Consumer<List<MessageConverter>> convertersConsumer) Manage the list ofMessageConverterinstances to be used to convert payloads.voidmanageMethodArgumentResolvers(Consumer<List<HandlerMethodArgumentResolver>> resolversConsumer) Manage the list ofHandlerMethodArgumentResolverinstances to be used for resolving method arguments.voidregisterEndpoint(Endpoint endpoint) Register anEndpointwithin this registrar for later processing.voidsetBeanFactory(BeanFactory beanFactory) voidsetDefaultListenerContainerFactoryBeanName(String defaultListenerContainerFactoryBeanName) Set the bean name for the defaultMessageListenerContainerFactory.voidsetJacksonMessageConverterMigration(JacksonMessageConverterMigration jacksonMessageConverterMigration) Set the object mapper to be used to deserialize payloads fot SqsListener endpoints.voidsetListenerContainerRegistry(MessageListenerContainerRegistry listenerContainerRegistry) Set a customMessageListenerContainerRegistry.voidsetMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory) Set a customMessageHandlerMethodFactoryimplementation.voidsetMessageListenerContainerRegistryBeanName(String messageListenerContainerRegistryBeanName) Set the bean name for theMessageListenerContainerRegistry.voidsetMethodPayloadTypeInferrer(@Nullable MethodPayloadTypeInferrer methodPayloadTypeInferrer) Set theMethodPayloadTypeInferrerto be used for inferring payload types from listener method signatures.voidsetValidator(Validator validator) Set theValidatorinstance used for payload validating inHandlerMethodArgumentResolverinstances.
-
Field Details
-
DEFAULT_LISTENER_CONTAINER_FACTORY_BEAN_NAME
- See Also:
-
-
Constructor Details
-
EndpointRegistrar
public EndpointRegistrar()
-
-
Method Details
-
setMessageHandlerMethodFactory
Set a customMessageHandlerMethodFactoryimplementation.- Parameters:
messageHandlerMethodFactory- the instance.
-
setMethodPayloadTypeInferrer
public void setMethodPayloadTypeInferrer(@Nullable MethodPayloadTypeInferrer methodPayloadTypeInferrer) Set theMethodPayloadTypeInferrerto be used for inferring payload types from listener method signatures. When set, the framework will automatically determine the expected payload type from the method parameters and configure the message converter accordingly.By default, uses
DefaultMethodPayloadTypeInferrer. Setting this tonulldisables automatic payload type inference.- Parameters:
methodPayloadTypeInferrer- the inferrer instance, or null to disable inference
-
getMethodPayloadTypeInferrer
Get theMethodPayloadTypeInferrerused for inferring payload types from listener method signatures.- Returns:
- the inferrer instance (defaults to
DefaultMethodPayloadTypeInferrer), or null if inference is disabled
-
setListenerContainerRegistry
public void setListenerContainerRegistry(MessageListenerContainerRegistry listenerContainerRegistry) Set a customMessageListenerContainerRegistry.- Parameters:
listenerContainerRegistry- the instance.
-
setDefaultListenerContainerFactoryBeanName
public void setDefaultListenerContainerFactoryBeanName(String defaultListenerContainerFactoryBeanName) Set the bean name for the defaultMessageListenerContainerFactory.- Parameters:
defaultListenerContainerFactoryBeanName- the bean name.
-
setMessageListenerContainerRegistryBeanName
public void setMessageListenerContainerRegistryBeanName(String messageListenerContainerRegistryBeanName) Set the bean name for theMessageListenerContainerRegistry.- Parameters:
messageListenerContainerRegistryBeanName- the bean name.
-
setJacksonMessageConverterMigration
public void setJacksonMessageConverterMigration(JacksonMessageConverterMigration jacksonMessageConverterMigration) Set the object mapper to be used to deserialize payloads fot SqsListener endpoints.- Parameters:
jacksonMessageConverterMigration- theJacksonMessageConverterMigrationinstance.
-
setValidator
Set theValidatorinstance used for payload validating inHandlerMethodArgumentResolverinstances.- Parameters:
validator- payload validator.
-
manageMessageConverters
Manage the list ofMessageConverterinstances to be used to convert payloads.- Parameters:
convertersConsumer- a consumer for the converters list.
-
manageMethodArgumentResolvers
public void manageMethodArgumentResolvers(Consumer<List<HandlerMethodArgumentResolver>> resolversConsumer) Manage the list ofHandlerMethodArgumentResolverinstances to be used for resolving method arguments.- Parameters:
resolversConsumer- a consumer for the resolvers list.
-
getMessageConverterConsumer
Get the message converters list consumer.- Returns:
- the consumer.
-
getMethodArgumentResolversConsumer
Get the method argument resolvers list consumer.- Returns:
- the consumer.
-
getJacksonMessageConverterMigration
Get the object mapper used to deserialize payloads.- Returns:
- the object mapper instance.
-
getMessageHandlerMethodFactory
Return theMessageHandlerMethodFactoryto be used to createMessageHandlerinstances for theEndpoints.- Returns:
- the factory instance.
-
getValidator
Return theValidatorinstance used for payload validating inHandlerMethodArgumentResolverinstances.- Returns:
- the payload validator.
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
registerEndpoint
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceSmartInitializingSingleton
-