how to subscribe in java general