Thanks Mark, now my gateway doesn't start automatically.
However, I also need to be able to set the connection parameters before starting the gateway. When I use the following Spring config, it doesn't appear as if I can change for example the username before calling start() on the gateway:
Code:
<bean id="rcf" class="com.rabbitmq.client.ConnectionFactory">
<property name="requestedHeartbeat" value="10"/>
</bean>
<rabbit:connection-factory id="connectionFactory"
port="${ei.messaging.amqp.portnumber}"
host="${ei.messaging.amqp.servername}"
username="${ei.messaging.amqp.username}"
password="${ei.messaging.amqp.password}"
connection-factory="rcf"
/>
<rabbit:admin connection-factory="connectionFactory" auto-startup="false"/>
The server startup code:
Code:
AmqpInboundGateway amqpInboundGateway = spring.getBean("amqpInboundGateway",AmqpInboundGateway.class);
amqpInboundGateway.setReplyTimeout(4000);
ConnectionFactory rcf = spring.getBean("rcf", ConnectionFactory.class);
rcf.setUsername("xxxxxxx");
// Still tries to connect with the username configured in Spring xml...
amqpInboundGateway.start();