Could you resend the message fixing the formatting? We can hardly read your 
email.

—
Denis

> On Sep 26, 2017, at 5:57 AM, elopez779 <[email protected]> wrote:
> 
> Hello, Although I've read many topics on this subject, I haven't found a 
> solution to my problem. First of all, I'm a beginner with Ignite and I'm a 
> just arrived to my project. I need to use Ignite as a memory cache for 
> Cassandra and I have tried an example applicaction to prove it. We cannot use 
> Spring config files so, I have to configure Ignite programmatically. The 
> example I've tried is closely related with the example explained by Riccardo 
> Iacomini in 
> https://medium.com/@iacomini.riccardo/how-to-use-apache-ignite-as-cassandra-cache-layer-e24659e31243
>  I think the persistence XML file is standard and there is nothing wrong in 
> it: REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1} AND 
> DURABLE_WRITES = true comment = 'Cache test' AND read_repair_chance = 0.2 and 
> finally the code. Practically all the code is inserted in class because this 
> wanted to be a quick test: 
> ------------------------------------------------------------------- 
> IgniteConfiguration cfg = new IgniteConfiguration(); CacheConfiguration 
> configuration = new CacheConfiguration(); 
> configuration.setName("cache-prueba"); // The connection with Cassandra is 
> through SSL String truststorePath = "C:\\certificates\\cassandra.keystore"; 
> String truststorePassword = "changeit"; String keystorePath = 
> "C:\\certificates\\cliente-cert.p12"; String keystorePassword = "1234"; 
> SSLContext context = getSSLContext(truststorePath, truststorePassword, 
> keystorePath, keystorePassword); String [] cipherSuites = 
> {"TLS_RSA_WITH_AES_128_CBC_SHA","TLS_DHE_RSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"};
>  DataSource dataSource = new DataSource(); 
> dataSource.setContactPoints("192.168.4.167"); dataSource.setPort(9042); 
> SSLOptions sslOptions = new SSLOptions(context, cipherSuites); 
> dataSource.setSslOptions(sslOptions); dataSource.setUseSSL(true); 
> RoundRobinPolicy robinPolicy = new RoundRobinPolicy(); 
> dataSource.setLoadBalancingPolicy(robinPolicy); 
> dataSource.setReadConsistency("ONE"); dataSource.setWriteConsistency("ONE");  
> String persistenceSettingsXml = FileUtils.readFileToString(new 
> File("C:\\01\\cache-prueba.xml"), "utf-8"); KeyValuePersistenceSettings 
> persistenceSettings = new 
> KeyValuePersistenceSettings(persistenceSettingsXml); 
> CassandraCacheStoreFactory cacheStoreFactory = new 
> CassandraCacheStoreFactory(); cacheStoreFactory.setDataSource(dataSource); 
> cacheStoreFactory.setPersistenceSettings(persistenceSettings); 
> configuration.setCacheStoreFactory(cacheStoreFactory); 
> configuration.setWriteThrough(true); 
> configuration.setWriteBehindEnabled(true); 
> configuration.setReadThrough(true); // Sets the cache configuration 
> cfg.setCacheConfiguration(configuration); // Starting Ignite 
> Ignition.setClientMode(true); Ignite ignite = Ignition.start(cfg); final 
> IgniteCache<String, ClaseLectura> cache = 
> ignite.getOrCreateCache("cache-prueba"); // writing test    for (int i = 0; i 
> < 50; i++) { cache.put(String.valueOf(i), new ClaseLectura("AAA", 10)); } 
> ----------------------------------------------- ClaseLectura is as follows: 
> public class ClaseLectura implements Serializable { private String value1; 
> private int value2; public ClaseLectura() { super(); } public 
> ClaseLectura(String v1, int v2) { this.value1 = v1; this.value2 = v2; } 
> public String getValue1() { return value1; } public int getValue2() { return 
> value2; } public void setValue1(String v1) { value1 = v1; } public void 
> setValue2(int v2) { value2 = v2; } public String toString() { return value1 + 
> " ; " + String.valueOf(value2); } } cache-prueba.xml (the persistence 
> description) is read correctly as I can see while debugging. I start an 
> Ignite server (ignite.bat) and I start the application and everything seems 
> OK. The for loop is executed correctly by I don't see any result in the 
> cassandra table. The SSL connection is Ok because I've tried it with another 
> app connecting directly to Cassandra. I've read many many topics but I don't 
> find a solution. Sorry for my really long mail and for my broken english. 
> Please, any kind of help will be really appreciated. Thanks. 
> Sent from the Apache Ignite Users mailing list archive 
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.

Reply via email to