How to setup the ack timer for guarantee messaging

@alhung thanks for the code. Firstly, when you receive a message the message data shouldn’t be overwritten, but that’s what you’re doing with the line:
SetText(Encoding.ASCII.GetString(message.BinaryAttachment));
I’m not sure what you’re trying to do here, but you’re reading the message payload ("Binary Attachment’) and then over-writing it.

Secondly, it would be worth checking the return code from Flow.Ack() - are you getting SOLCLIENT_OK?

Lastly, have a look at IContext Interface, particularly:

Consequently, applications must not block in callback/delegate routines.
Which, unfortunately, is what you’re doing with:
Thread.Sleep(Convert.ToInt32(this.txtAckdelay.Text));
What I recommend you do is pass the received message to a data structure inside HandleMessageEvent(). Then in your application thread, read the messages in your data structure, apply your delay and then acknowledge them.