Thank you,
@Alberto Iglesias. Now setWill() is working!
However, these issues still remain:
1. onConnect() gets called only on connection success. There is no callback for connection failure. e.g. when broker is not available or if it is mis-typed.
2. After a successful connection, there is no connectionLost() event.
3. Topic is missing in Received() callback.
4. [Minor] Need APIs to set connection timeout and keep alive period.
Above functionality is needed to make error resilient MQTT app.
Thanks again for your support.