Merge branch '1.3.x'

This commit is contained in:
Stephane Nicoll
2016-02-12 16:26:41 +01:00
6 changed files with 326 additions and 57 deletions

View File

@@ -3504,6 +3504,44 @@ The following component creates a listener endpoint on the `someQueue` destinati
TIP: Check {spring-javadoc}/jms/annotation/EnableJms.{dc-ext}[the Javadoc of `@EnableJms`] for
more details.
If you need to create more `JmsListenerContainerFactory` instances or if you want to override
the default, Spring Boot provides a `JmsListenerContainerFactoryConfigurer` that you can use
to initialize a `DefaultJmsListenerContainerFactory` with the same settings as the one that
is auto-configured.
For instance, the following exposes another factory that uses a specific `MessageConverter`:
[source,java,indent=0]
----
@Configuration
static class JmsConfiguration {
@Bean
public DefaultJmsListenerContainerFactory myFactory(
JmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = configurer
.createJmsListenerContainerFactory(connectionFactory());
factory.setMessageConverter(myMessageConverter());
return factory;
}
}
----
That you can use in any `@JmsListener`-annotated method as follows:
[source,java,indent=0]
----
@Component
public class MyBean {
@JmsListener(destination = "someQueue", **containerFactory="myFactory"**)
public void processMessage(String content) {
// ...
}
}
----
[[boot-features-amqp]]
@@ -3600,6 +3638,44 @@ The following component creates a listener endpoint on the `someQueue` queue:
TIP: Check {spring-amqp-javadoc}/rabbit/annotation/EnableRabbit.{dc-ext}[the Javadoc of `@EnableRabbit`]
for more details.
If you need to create more `RabbitListenerContainerFactory` instances or if you want to override
the default, Spring Boot provides a `RabbitListenerContainerFactoryConfigurer` that you can use
to initialize a `SimpleRabbitListenerContainerFactory` with the same settings as the one that
is auto-configured.
For instance, the following exposes another factory that uses a specific `MessageConverter`:
[source,java,indent=0]
----
@Configuration
static class RabbitConfiguration {
@Bean
public SimpleRabbitListenerContainerFactory myFactory(
RabbitListenerContainerFactoryConfigurer configurer) {
SimpleRabbitListenerContainerFactory factory = configurer
.createRabbitListenerContainerFactory(connectionFactory());
factory.setMessageConverter(myMessageConverter());
return factory;
}
}
----
That you can use in any `@RabbitListener`-annotated method as follows:
[source,java,indent=0]
----
@Component
public class MyBean {
@RabbitListener(queues = "someQueue", **containerFactory="myFactory"**)
public void processMessage(String content) {
// ...
}
}
----
[[boot-features-email]]