I am trying to do a similar configuration with the Spring RabbitTemplate as shown below with the standard client library without much luck

Code:
channel.addConfirmListener(new ConfirmListener() {
                @Override
                public void handleAck(long l, boolean b) throws IOException {
                    System.err.println("ack "+l+ " "+ b);
                }

                @Override
                public void handleNack(long l, boolean b) throws IOException {
                    System.err.println("nack "+l+ " "+ b);
                }
            });
I have setup the RabbitTemplate with publisher-confirms=true and have tried the following.

Code:
    public void runWithSpring(){
      
        rabbitTemplate.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
            @Override
            public void confirm(CorrelationData correlationData, boolean b) {
                System.err.println("confirmedMessage");
            }
        });

        rabbitTemplate.setReturnCallback(new RabbitTemplate.ReturnCallback() {
            @Override
            public void returnedMessage(Message message, int i, String s, String s1, String s2) {
                System.err.println("Returned Message");
              
            }
        });
        rabbitTemplate.convertAndSend("myqueue", "foriffo");
    }
I was expecting my test to hit the Confirm callback. Any idea what I am missing?