@@ -102,6 +102,18 @@ public void cleanUp() throws IOException, InterruptedException {
102102
103103 protected RabbitTemplate getCustomRabbitTemplate (String p12Path , String p12Passphrase )
104104 throws Exception {
105+ return getCustomRabbitTemplate (
106+ p12Path , p12Passphrase , CachingConnectionFactory .ConfirmType .NONE );
107+ }
108+
109+ // overload for tests needing setConfirmCallback (e.g.
110+ // publishWithAuthorizedButInconsistentRoutingKeyFails) to observe a broker-side nack,
111+ // independently of the Dispatcher's own publisher-confirm-type setting
112+ protected RabbitTemplate getCustomRabbitTemplate (
113+ String p12Path ,
114+ String p12Passphrase ,
115+ CachingConnectionFactory .ConfirmType confirmType )
116+ throws Exception {
105117 com .rabbitmq .client .ConnectionFactory cf = new com .rabbitmq .client .ConnectionFactory ();
106118 cf .setHost (rabbitMQContainer .getHost ());
107119 cf .setPort (rabbitMQContainer .getAmqpsPort ());
@@ -112,7 +124,7 @@ protected RabbitTemplate getCustomRabbitTemplate(String p12Path, String p12Passp
112124
113125 cf .setSaslConfig (DefaultSaslConfig .EXTERNAL );
114126 CachingConnectionFactory ccf = new CachingConnectionFactory (cf );
115- ccf .setPublisherConfirmType (CachingConnectionFactory . ConfirmType . CORRELATED );
127+ ccf .setPublisherConfirmType (confirmType );
116128 ccf .setPublisherReturns (true );
117129
118130 return new RabbitTemplate (ccf );
@@ -152,7 +164,6 @@ public void initialize(ConfigurableApplicationContext applicationContext) {
152164
153165 // must be set to handle PublisherConfirms in other RabbitTemplates,
154166 // even if we don't use it in Dispatcher
155- "spring.rabbitmq.publisher-confirm-type=correlated" ,
156167 "spring.rabbitmq.publisher-returns=true" ,
157168 "spring.rabbitmq.template.mandatory=true" ,
158169 "spring.rabbitmq.virtual-host=15-15_v2.1" ,
0 commit comments