I am Trying to Lookup a distributed cache on my VPN using below snippet . I am not able to connect distributed Cache configured .Can someone provide me details to read Cached information from configured distributed Cache using Java API.
// Connect, create a producer and a consumer, and start the consumer.
session.connect();
prod = session.getMessageProducer(new PubCallback());
cons = session.getMessageConsumer(new PrintingMessageHandler());
printRouterInfo();
cons.start();
Topic topic = JCSMPFactory.onlyInstance().createTopic(SampleUtils.SAMPLE_TOPICENDPOINT);
// Publish a single message to make sure there is something cached.
BytesXMLMessage msg = JCSMPFactory.onlyInstance().createMessage(BytesXMLMessage.class);
msg.writeAttachment("published message".getBytes());
prod.send(msg, topic);
// Create the cache session based on parameters on the command line.
cacheSession = SampleUtils.newCacheSession(session, conf);
// Perform the cache request.
** CacheRequestResult result = cacheSession.sendCacheRequest(1L, topic,
conf.getSubscribe(), conf.getAction());**
System.out.println("Cache Request=" + result + ", Cached Messages Received=" +
session.getSessionStats().getStat(StatType.CACHED_MSGS_RECVED));
I am getting Timed out Exception while reading from cache .