I think the long if-else is hard to read, with your code you could do as
```
if (req_id != null) {
   ...
   return;
}

switch (msg.cmd) {
   ...
}
```