What is the best way to implement the subscribe side in the pub/sub connection?
If you want to guarantee that all messages are received by a subscriber, then use a durable subscriber. If you explicitly close the connection, or there is a network failure, all unacknowledged messages will be re-delivered the next time you subscribe.
The publisher and subscriber are completely asynchronus, so it is not possible to determine if a publisher has finished using JMS. However, you could always set a property on the last message published to indicate the end of transmission--though this is application specific.