diff --git a/src/docbkx/amqp.xml b/src/docbkx/amqp.xml index 5989d0ad..06c2ab3a 100644 --- a/src/docbkx/amqp.xml +++ b/src/docbkx/amqp.xml @@ -228,19 +228,24 @@ org.springframework.amqp.rabbit.connection.Connection which is a wrapper for com.rabbitmq.client.Connection. The - simplest implementation we provide is - SingleConnectionFactory which establishes a - single connection that can be shared by the application. Sharing + only concrete implementation we provide is + CachingConnectionFactory which establishes a + single connection proxy that can be shared by the application. Sharing of the connection is possible since the "unit of work" for messaging with AMQP is actually a "channel" (in some ways, this is similar to the relationship between a Connection and a Session in JMS). As you can imagine, the connection instance provides a - createChannel method. When creating an - instance of SingleConnectionFactory, the - 'hostname' can be provided via the constructor. The 'username' and - 'password' properties should be provided as well. + createChannel method. The + CachingConnectionFactory implementation + supports caching of those channels, and it maintains separate + caches for channels based on whether they are transactional or not. + When creating an instance of CachingConnectionFactory, + the 'hostname' can be provided via the constructor. The 'username' and + 'password' properties should be provided as well. If you would like to + configure the size of the channel cache (the default is 1), you could + call the setChannelCacheSize() method here as well. - When using XML, the configuration might look like this: + class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory"> ]]> - There is also a - CachingConnectionFactory implementation, - which is superior to the - SingleConnectionFactory in terms of - performance and resilience. The - CachingConnectionFactory should be - considered the default for most practical usage, and - SingleConnectionFactory as useful for - simple tests and maybe as a building block for extending the - framework. A ConnectionFactory can + There is also a SingleConnectionFactory + implementation which is only available in the unit test code of the framework. + It is simpler than CachingConnectionFactory since it does + not cache channels, but it is not intended for practical usage + outside of simple tests due to its lack of performance and resilience. + If you find a need to implement your own ConnectionFactory + for some reason, the AbstractConnectionFactory + base class may provide a nice starting point. + + A ConnectionFactory can be created quickly and conveniently using the rabbit namespace: ]]> In most cases this will be preferable since the framework can choose the best - defaults for you, and it will always choose a - CachingConnectionFactory. + defaults for you. The created instance will be a + CachingConnectionFactory. + + Keep in mind that the default cache size for channels is 1. + If you want more channels to be cached set a larger value via the + 'channelCacheSize' property. In XML it would look like this: + + + + + +]]> + And with the namespace you can just add the 'channel-cache-size' attribute: + ]]> +