Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6a4a0e3f
Commit
6a4a0e3f
authored
Dec 12, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Make RabbitTemplate exchange and routingKey configurable"
Closes gh-10978
parent
4e31d204
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
16 deletions
+14
-16
RabbitAutoConfiguration.java
...work/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
+0
-1
RabbitProperties.java
...ngframework/boot/autoconfigure/amqp/RabbitProperties.java
+0
-13
RabbitAutoConfigurationTests.java
...boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
+12
-2
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+2
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
View file @
6a4a0e3f
...
@@ -190,7 +190,6 @@ public class RabbitAutoConfiguration {
...
@@ -190,7 +190,6 @@ public class RabbitAutoConfiguration {
}
}
rabbitTemplate
.
setExchange
(
templateProperties
.
getExchange
());
rabbitTemplate
.
setExchange
(
templateProperties
.
getExchange
());
rabbitTemplate
.
setRoutingKey
(
templateProperties
.
getRoutingKey
());
rabbitTemplate
.
setRoutingKey
(
templateProperties
.
getRoutingKey
());
rabbitTemplate
.
setChannelTransacted
(
templateProperties
.
isChannelTransacted
());
return
rabbitTemplate
;
return
rabbitTemplate
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
View file @
6a4a0e3f
...
@@ -713,11 +713,6 @@ public class RabbitProperties {
...
@@ -713,11 +713,6 @@ public class RabbitProperties {
*/
*/
private
String
routingKey
=
""
;
private
String
routingKey
=
""
;
/**
* Enable transactional channels.
*/
private
boolean
channelTransacted
;
public
Retry
getRetry
()
{
public
Retry
getRetry
()
{
return
this
.
retry
;
return
this
.
retry
;
}
}
...
@@ -762,14 +757,6 @@ public class RabbitProperties {
...
@@ -762,14 +757,6 @@ public class RabbitProperties {
this
.
routingKey
=
routingKey
;
this
.
routingKey
=
routingKey
;
}
}
public
boolean
isChannelTransacted
()
{
return
this
.
channelTransacted
;
}
public
void
setChannelTransacted
(
boolean
channelTransacted
)
{
this
.
channelTransacted
=
channelTransacted
;
}
}
}
public
static
class
Retry
{
public
static
class
Retry
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
View file @
6a4a0e3f
...
@@ -113,8 +113,6 @@ public class RabbitAutoConfigurationTests {
...
@@ -113,8 +113,6 @@ public class RabbitAutoConfigurationTests {
.
isEqualTo
(
defaultRabbitTemplate
.
getRoutingKey
());
.
isEqualTo
(
defaultRabbitTemplate
.
getRoutingKey
());
assertThat
(
rabbitTemplate
.
getExchange
())
assertThat
(
rabbitTemplate
.
getExchange
())
.
isEqualTo
(
defaultRabbitTemplate
.
getExchange
());
.
isEqualTo
(
defaultRabbitTemplate
.
getExchange
());
assertThat
(
rabbitTemplate
.
isChannelTransacted
())
.
isEqualTo
(
defaultRabbitTemplate
.
isChannelTransacted
());
});
});
}
}
...
@@ -239,6 +237,18 @@ public class RabbitAutoConfigurationTests {
...
@@ -239,6 +237,18 @@ public class RabbitAutoConfigurationTests {
});
});
}
}
@Test
public
void
testRabbitTemplateExchangeAndRoutingKey
()
{
this
.
contextRunner
.
withUserConfiguration
(
TestConfiguration
.
class
)
.
withPropertyValues
(
"spring.rabbitmq.template.exchange:my-exchange"
,
"spring.rabbitmq.template.routing-key:my-routing-key"
)
.
run
((
context
)
->
{
RabbitTemplate
rabbitTemplate
=
context
.
getBean
(
RabbitTemplate
.
class
);
assertThat
(
rabbitTemplate
.
getExchange
()).
isEqualTo
(
"my-exchange"
);
assertThat
(
rabbitTemplate
.
getRoutingKey
()).
isEqualTo
(
"my-routing-key"
);
});
}
@Test
@Test
public
void
testRabbitTemplateMandatory
()
{
public
void
testRabbitTemplateMandatory
()
{
this
.
contextRunner
.
withUserConfiguration
(
TestConfiguration
.
class
)
this
.
contextRunner
.
withUserConfiguration
(
TestConfiguration
.
class
)
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
6a4a0e3f
...
@@ -1058,6 +1058,7 @@ content into your application. Rather, pick only the properties that you need.
...
@@ -1058,6 +1058,7 @@ content into your application. Rather, pick only the properties that you need.
spring.rabbitmq.ssl.trust-store-password= # Password used to access the trust store.
spring.rabbitmq.ssl.trust-store-password= # Password used to access the trust store.
spring.rabbitmq.ssl.trust-store-type=JKS # Trust store type.
spring.rabbitmq.ssl.trust-store-type=JKS # Trust store type.
spring.rabbitmq.ssl.algorithm= # SSL algorithm to use. By default, configured by the Rabbit client library.
spring.rabbitmq.ssl.algorithm= # SSL algorithm to use. By default, configured by the Rabbit client library.
spring.rabbitmq.template.exchange= # Name of the default exchange to use for send operations.
spring.rabbitmq.template.mandatory=false # Whether to enable mandatory messages.
spring.rabbitmq.template.mandatory=false # Whether to enable mandatory messages.
spring.rabbitmq.template.receive-timeout=0 # Timeout for `receive()` methods.
spring.rabbitmq.template.receive-timeout=0 # Timeout for `receive()` methods.
spring.rabbitmq.template.reply-timeout=5000 # Timeout for `sendAndReceive()` methods.
spring.rabbitmq.template.reply-timeout=5000 # Timeout for `sendAndReceive()` methods.
...
@@ -1066,6 +1067,7 @@ content into your application. Rather, pick only the properties that you need.
...
@@ -1066,6 +1067,7 @@ content into your application. Rather, pick only the properties that you need.
spring.rabbitmq.template.retry.max-attempts=3 # Maximum number of attempts to publish a message.
spring.rabbitmq.template.retry.max-attempts=3 # Maximum number of attempts to publish a message.
spring.rabbitmq.template.retry.max-interval=10000 # Maximum number of attempts to publish a message.
spring.rabbitmq.template.retry.max-interval=10000 # Maximum number of attempts to publish a message.
spring.rabbitmq.template.retry.multiplier=1.0 # Multiplier to apply to the previous publishing retry interval.
spring.rabbitmq.template.retry.multiplier=1.0 # Multiplier to apply to the previous publishing retry interval.
spring.rabbitmq.template.routing-key= # Value of a default routing key to use for send operations.
spring.rabbitmq.username= # Login user to authenticate to the broker.
spring.rabbitmq.username= # Login user to authenticate to the broker.
spring.rabbitmq.virtual-host= # Virtual host to use when connecting to the broker.
spring.rabbitmq.virtual-host= # Virtual host to use when connecting to the broker.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment