I have been building a very contrived example using Spring-AMQP and Spring-Integration-AMQP and have noticed that whenever declaring my exchanges/queues/binding in the application using the "rabbit" namespace I am seeing a huge decrease in message throughput. I cranked up the logging level and can see that my exchanges/queues/bindings are being declared on every message publish. I didn't see anything about this in JIRA or in the forum so I thought I would point it out.
Example:
Logs:Code:<bean id="amqpConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory"> <constructor-arg value="localhost"/> <property name="username" value="guest"/> <property name="password" value="guest"/> </bean> <amqp:inbound-channel-adapter channel="amqpLoopIn" queue-names="loopIn" connection-factory="amqpConnectionFactory"/> <integration:channel id="amqpLoopIn" /> <amqp:outbound-channel-adapter channel="amqpLoopIn" exchange-name="loop" amqp-template="amqpTemplate"/> <bean id="amqpTemplate" class="org.springframework.amqp.rabbit.core.RabbitTemplate"> <property name="connectionFactory" ref="amqpConnectionFactory" /> </bean> <rabbit:admin connection-factory="amqpConnectionFactory"/> <rabbit:queue name="loopIn" durable="true"/> <rabbit:fanout-exchange name="loop" durable="true"> <rabbit:bindings> <rabbit:binding queue="loopIn"/> </rabbit:bindings> </rabbit:fanout-exchange>
Code:DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Returning cached Channel: AMQChannel(amqp://guest@localhost:5672/,11) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer - Waiting for message from consumer. DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Retrieving delivery for Consumer: tag=[amq.ctag-yntvt7Wdxp+TJoMra6gJmw==], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@localhost:5672/,7), acknowledgeMode=AUTO local queue size=0 DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Storing delivery for Consumer: tag=[amq.ctag-lw67hNkx+SpzqI4AVy8Hxw==], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@localhost:5672/,6), acknowledgeMode=AUTO local queue size=0 DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Found cached Rabbit Channel DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitTemplate - Executing callback on RabbitMQ Channel: Cached Rabbit Channel: AMQChannel(amqp://guest@localhost:5672/,12) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitAdmin - declaring Exchange 'loop' DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Received message: (Body:'Test Test Test'; ID:null; Content:text/plain; Headers:{}; Exchange:loop; RoutingKey:; Reply:null; DeliveryMode:PERSISTENT; DeliveryTag:580) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitAdmin - declaring Queue 'loopIn' DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitAdmin - Binding queue [loopIn] to exchange [loop] with routing key [] DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Returning cached Channel: AMQChannel(amqp://guest@localhost:5672/,12) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitAdmin - Declarations finished DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Found cached Rabbit Channel DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitTemplate - Executing callback on RabbitMQ Channel: Cached Rabbit Channel: AMQChannel(amqp://guest@localhost:5672/,11) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitTemplate - Publishing message on exchange [loop], routingKey = [] DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.core.RabbitAdmin - Initializing declarations DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Returning cached Channel: AMQChannel(amqp://guest@localhost:5672/,11) DEBUG 04/26/2011 10:38:20 org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer - Waiting for message from consumer.


Reply With Quote
