Package com.minicrm.mini_crm_api.config
Class RabbitMqConfiguration
java.lang.Object
com.minicrm.mini_crm_api.config.RabbitMqConfiguration
Configures the neccessary RabbitMQ exhanges, queues and bindings
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactorybatchListenerFactory(org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer configurer, org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory) This is the specialized factory for listeners that consume messages in batches.org.springframework.amqp.support.converter.MessageConverterDefines a MessageConverter bean that will be used by RabbitTemplate and RabbitListener to serialize and deserialize message payloads.org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactorysingleListenerFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer configurer) This is the default factory for listeners that consume one message at a time.
-
Field Details
-
CAMPAIGN_EXCHANGE_NAME
- See Also:
-
CAMPAIGN_PROCESSING_QUEUE_NAME
- See Also:
-
CAMPAIGN_PROCESSING_ROUTING_KEY
- See Also:
-
INGESTION_EXCHANGE_NAME
- See Also:
-
CUSTOMER_INGESTION_QUEUE_NAME
- See Also:
-
ORDER_INGESTION_QUEUE_NAME
- See Also:
-
CUSTOMER_INGESTION_ROUTING_KEY
- See Also:
-
ORDER_INGESTION_ROUTING_KEY
- See Also:
-
RECEIPT_QUEUE_NAME
- See Also:
-
RECEIPT_ROUTING_KEY
- See Also:
-
-
Constructor Details
-
RabbitMqConfiguration
public RabbitMqConfiguration()
-
-
Method Details
-
singleListenerFactory
@Bean public org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory singleListenerFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer configurer) This is the default factory for listeners that consume one message at a time.- Parameters:
connectionFactory- The RabbitMQ connection factory.configurer- The configurer to apply default settings.- Returns:
- A SimpleRabbitListenerContainerFactory configured for single message
-
batchListenerFactory
@Bean public org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory batchListenerFactory(org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer configurer, org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory) This is the specialized factory for listeners that consume messages in batches. batch size and timeout are configured in application.properties- Parameters:
configurer- The configurer to apply default settings.connectionFactory- The RabbitMQ connection factory.- Returns:
- A SimpleRabbitListenerContainerFactory configured for batch message consumption.
-
messageConverter
@Bean public org.springframework.amqp.support.converter.MessageConverter messageConverter()Defines a MessageConverter bean that will be used by RabbitTemplate and RabbitListener to serialize and deserialize message payloads.By defining this bean, we are telling Spring to use JSON for all our message payloads, which allows us to send complex DTOs over the message queue.
- Returns:
- A Jackson2JsonMessageConverter instance.
-