Check out example codes for "spring AMQP async nack". It will help you in understanding the concepts better.

Code Example 1

// setAcknowledgeMode to MANUAL
@Bean
fun jsaFactory(
    connectionFactory: ConnectionFactory,
    configurer: SimpleRabbitListenerContainerFactoryConfigurer
): SimpleRabbitListenerContainerFactory {
    val factory = SimpleRabbitListenerContainerFactory()

    factory.setAcknowledgeMode(AcknowledgeMode.MANUAL)
    factory.setMessageConverter(jsonMessageConverter())

    configurer.configure(factory, connectionFactory)

    return factory
}

// throw AmqpRejectAndDontRequeueException to nack
@RabbitListener(queues = ["salesforce.contact-courses.update"])
fun update(message: CourseRequestDto): Mono<Void> {
    message.email ?: return Mono.error<Void>(AmqpRejectAndDontRequeueException("Invalid message received"))

    return courseDtoBuilder.getInstance(message)
        .flatMap { contactRestClient.coursePatch(message.email, it) }
        .doOnError { throw AmqpRejectAndDontRequeueException(it.message) } // NACK
}

Learn ReactJs, React Native from akashmittal.com