ServiceReference reference = context.getServiceReference("com.hazelcast.core.HazelcastInstance");
HazelcastInstance instance = (HazelcastInstance) context.getService(reference);
context.ungetService(reference);
try {
IdGenerator idGenerator = instance.getIdGenerator("cellar-smaple-generator");
Long id = idGenerator.newId();
topic = instance.getTopic("cellar-sample-topic");
topic.addMessageListener(messageListener);
topic.publish(new Message("id="+id));
} catch (Exception ex) {
ex.printStackTrace();