1, depending on the configuration
1, pom.xml its dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
2, the configuration file
spring:
rabbitmq:
addresses: 192.168.200.100:5672
username: rabbit
password: 123456
virtual-host: /
publisher-confirms: true
publisher-returns: true
template:
mandatory: true
listener:
direct:
acknowledge-mode: manual
simple:
concurrency: 3
max-concurrency: 10
4, configuration parsing
Basic Configuration
spring.rabbitmq.host: server address
spring.rabbitmq.port: server port
spring.rabbitmq.addresses: a server connection, a plurality of comma separated Addresses take priority, then take Host
spring.rabbitmq.username: Username
spring.rabbitmq .password: password
spring.rabbitmq.virtual-host: Web Hosting
spring.rabbitmq.requested-heartbeat: Specifies the heartbeat timeout, in seconds, 0 is not specified; default 60s
spring.rabbitmq.publisher-Confirms: whether to enable publishing [OK]
spring.rabbitmq.publisher-returns: returns whether to enable [release]
spring.rabbitmq.connection-timeout: connection timeout, in milliseconds, 0 represents infinity, no timeout
ssl https access mode configuration
spring.rabbitmq.ssl.enabled: whether to support ssl
spring.rabbitmq.ssl.key-Store: Specifies the path hold key store SSL certificate is
spring.rabbitmq.ssl.key-store-password: Specifies the access key store password
spring .rabbitmq.ssl.trust-store: Specifies the SSL certificates held by the store Trust
spring.rabbitmq.ssl.trust-store-password: Specifies the trust password to access the store
spring.rabbitmq.ssl.algorithm: ssl algorithm used, for example, TLSv1.1
Cache configuration
spring.rabbitmq.cache.channel.size: channel number held in the cache
spring.rabbitmq.cache.channel.checkout-timeout: When the number of buffers is provided, obtaining a timeout from the channel buffer, in milliseconds; if 0, always create a new Channel
spring.rabbitmq.cache.connection.size: the number of connections cache, is only effective when cONNECTION mode
spring.rabbitmq.cache.connection.mode: connection factory cached mode: CHANNEL and cONNECTION
Message listener configuration
spring.rabbitmq.listener.simple.auto-startup: Start will be started automatically when the container
spring.rabbitmq.listener.simple.acknowledge-mode: mode confirmation message indicates that there are three possible arrangements, are none, manual (manual sign) auto (automatic sign)
spring.rabbitmq.listener.simple.concurrency: concurrent processing message number
spring.rabbitmq.listener.simple.max-concurrency: maximum number of concurrent message processing
spring.rabbitmq.listener.simple.prefetch: specify a how many can handle the request message, if there is a transaction, then, must be greater than the number of transaction.
spring.rabbitmq.listener.simple.transaction-size: Specifies the number of messages of a transaction, preferably less than equal to the number of prefetch.
spring.rabbitmq .listener.simple.default-requeue-rejected: determine whether the message is denied re-queue; the default is true (has a relationship with the MODE-parameter Acknowledge)
spring.rabbitmq.listener.simple.idle-Event-interval the: how much longer published container idle time, in milliseconds
Listening to retry
spring.rabbitmq.listener.simple.retry.enabled: Retry monitor is available
spring.rabbitmq.listener.simple.retry.max-attempts: maximum number of retries
spring.rabbitmq.listener.simple.retry.initial-interval: first first and second delivery attempt or the interval between the release message
spring.rabbitmq.listener.simple.retry.multiplier: re-applied to a multiplier try interval
spring.rabbitmq.listener.simple.retry.max-interval: maximum retry time interval
spring.rabbitmq.listener.simple.retry.stateless: Retry stateful or stateless
Operation template configuration
spring.rabbitmq.template.mandatory: enable enforcement information; default false, there must be set to true to return mode is in effect
spring.rabbitmq.template.receive-timeout: Timeout receive () operation
spring.rabbitmq.template.reply- timeout: sendAndReceive () operation timeout
spring.rabbitmq.template.retry.enabled: send retry is available
spring.rabbitmq.template.retry.max-attempts: maximum number of retries
spring.rabbitmq.template.retry.initial- interval: the first and second delivery attempt or the interval between the release message
spring.rabbitmq.template.retry.multiplier: re-applied to a multiplier try interval
spring.rabbitmq.template.retry.max-interval: maximum Retry interval
2, the message sending process messages and listens
1 Listener