How to send NACK(Negative Acknowledgement) using java API

Windowing, i.e, transport flow control, is unrelated to message.acknowledge(). Transport flow control is controlled by how fast you consume messages. If you do not call receive() on a synchronous consumer, or call stop() on an asynchronous consumer as in your cases, the transport window will close.

message.acknowledge() on the other hand is only for acknowledging the message has been received and consumed. At this point the message is removed from the persistent storage on the Solace broker. If you do not call message.acknowledge() this does not stop delivery of subsequent messages until max-unacked-message limit is reached which is typically quite large.

Unacknowledged messages are only redelivered on the next consumer to connect.