I have checked some similar cases about this issue , someone can solve it by
adding "autoFlushFrequency(1)" method to IgniteDataStreamer .I tried and
failed . My script is as below:public class IgniteJMS { public static void
main(String[] args) throws Exception {             Ignite ignite =
Ignition.start("c:\\users\\archer\\desktop\\default-config.xml");               
IgniteCache<String, Long> stmCache =
ignite.getOrCreateCache(CacheConfig2.wordCache());           
IgniteDataStreamer<String, Long> stmr = ignite.dataStreamer("wordstest");       
    
stmr.allowOverwrite(true);                      stmr.autoFlushFrequency(1);     
        
JmsStreamer<TextMessage, String, Long> jmsStreamer = new JmsStreamer<>();       
        
jmsStreamer.setIgnite(ignite);                  jmsStreamer.setStreamer(stmr);  
        
jmsStreamer.setConnectionFactory(new ActiveMQConnectionFactory("admin",
"admin", "tcp://192.168.2.202:61616"));                 
jmsStreamer.setTransacted(true);                
Destination dest = new ActiveMQQueue("FirstQueue");             
jmsStreamer.setDestination(dest);                       
jmsStreamer.setThreads(2);              
jmsStreamer.setTransformer(new MessageTransformer<TextMessage, String,
Long>() {                               @Override                               
public Map<String, Long> apply(TextMessage
message) {                                      final Map<String, Long> answer 
= new HashMap<String, Long>();                           
String text;                                    try {                           
                text = message.getText();                                       
} catch
(JMSException e) {                                              return 
Collections.emptyMap();                                  }                      
                         String[]
tokens = text.split(" ");                                               Long 
val = Long.parseLong(tokens[1]);                                   
System.out.println("key=" + tokens[0] + "-value=" + val + "##"); // it shows
up messages                                             answer.put(tokens[0], 
val);                                                                           
  return answer;                          }               
});                     jmsStreamer.start();            }       }}public class 
CacheConfig2 {public static
CacheConfiguration<String,Long> wordCache(){    CacheConfiguration<String,Long>
cfg = new CacheConfiguration<String,Long> ("wordstest");
cfg.setIndexedTypes(String.class,Long.class);
cfg.setStatisticsEnabled(true);
cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
cfg.setOffHeapMaxMemory(10 * 1024L * 1024L * 1024L);    return cfg;}}Hoping for
any repliies ! Thanks



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/binding-ActiveMQ-stream-to-Ignite-messages-can-show-out-but-Ignite-cache-contain-none-tp11895.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to