Combining Mqtt-sn publisher subscriber Thread example on different topics


Can anyone please provide me some idea about how to combine the mqtt-sn publisher example publishing on data topic with the mqtt-sn subscriber example subscribed on cmd topic. 

I want to combine this both example, I have looked for refference on devzone and got one post but there also the subscribe and publishing was on same topic. 

Can someone please provide some basic code snippet. Thanks.