I have the following listener component:
@Component
public class Receiver {
@RabbitListener(queues = "fmd-response")
public void receiveMessage(Response response, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException {
channel.basicAck(tag, false);
}
@PreDestroy
public void preDestroy() {
}
}
What should be put into preDestroy()
in order to close the channel automatically created when loading the component?
I need this for reloading the component with JRebel, because on every reload a new channel will be created:
127.0.0.1:54916 (1)
guest idle 0 250 0
127.0.0.1:54916 (2)
guest idle 0 250 0
127.0.0.1:54916 (3)
guest idle 0 250 0
127.0.0.1:54916 (4)
guest idle 0 250 0
127.0.0.1:54916 (5)
guest idle 0 250 0
127.0.0.1:54916 (6)
guest idle 0 250 0