Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D3B57200D16 for ; Tue, 10 Oct 2017 19:55:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D2386160BE0; Tue, 10 Oct 2017 17:55:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F152B1609CB for ; Tue, 10 Oct 2017 19:55:11 +0200 (CEST) Received: (qmail 24968 invoked by uid 500); 10 Oct 2017 17:55:11 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 24958 invoked by uid 99); 10 Oct 2017 17:55:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Oct 2017 17:55:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 2EC47183D9A for ; Tue, 10 Oct 2017 17:55:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ouwLZqi_RkAJ for ; Tue, 10 Oct 2017 17:55:08 +0000 (UTC) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id F156D5FC81 for ; Tue, 10 Oct 2017 17:55:07 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id q124so7443066wmb.0 for ; Tue, 10 Oct 2017 10:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=aIF7gRqLEAIvp1s3bbCX7Em8LxNXMJjZeVZzNCbyCmc=; b=JWclu67WNGMKAt4BfarMuipWCGclGvYiCqCoWttsTky+8xlHlqxoqI3XK1sPVqhD3D Xhdzq+g2LAlUQqB5g772nMuJmFQ4z1Aofy7WzsgedKlr2a1Pvwo9m8z0VRiA/iUuTTkm 5h/2LJoACNp2DPU8rXrJ4D6Oi8vye/REl5iB+K7Dva8VVwlVYkSV8xyctLhyHzzKCSPf PJVm2h1HVRcOMBdP+6999lkwTpF29SptcZVfjEzM1Z1lnTDmbvvny2CBmAkCWRCfqcFN OEdSgASlrHUIiubjCX8gyI6sQuAzIsMzZ6djfM2Yuql8qUL7yc5Nask+86YHrX+P6VZ9 1NXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=aIF7gRqLEAIvp1s3bbCX7Em8LxNXMJjZeVZzNCbyCmc=; b=bJH154j0yx9W6lMCfnaxhGy3rv5AgCMibFIk1k3ZAADRLUVf0TQUu6IS3Qc6tyqkSo kzZM0Ocoh9Bk8T3VNVxPESs6cTvTRRs9/jCEwY9g0uBtQwK8BLwtP5W8QlrHJ1RAk9ny SG/zNVVlM6N5i+fDuTNwm2wNEiBI69Z678jEgZRtXhZjfA4Q57OqgZW2aYsmb6RZFHla 0+n6Rg1YG8KxMxjFkj2y/U0OPDlCEycjarrRwVz3sX/hU22yWl6zgPwiVxd4khzizyAy xBqw0NOGKRg4IHF9TJV1nA/ir4WOmj3MPv9Gs63/XMKIFH/Ky2JtfVmYemgaJPbhJrIF ip2w== X-Gm-Message-State: AMCzsaVNPViczHSIBTsa2DaiTfvLioadIonRMOLhSGdl5SKW25MqzVyB BkdH0SWiOprkAjfRPCt6CuTNn3ueu8n9ckH/qWD0YjB5 X-Google-Smtp-Source: AOwi7QAru6R951B1J2FPqSr72B7MUOq9QnI3lVPBlVo6GxxMPeeWi4+QPO8/WnIvZ0U9MpSzoRfZ4mKIo/tNwmsREPE= X-Received: by 10.223.129.228 with SMTP id 91mr14063595wra.233.1507658106655; Tue, 10 Oct 2017 10:55:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.199.132 with HTTP; Tue, 10 Oct 2017 10:55:06 -0700 (PDT) In-Reply-To: References: <1507038203033-0.post@n6.nabble.com> <1507040715149-0.post@n6.nabble.com> <1507041528984-0.post@n6.nabble.com> <1507044879901-0.post@n6.nabble.com> <1507047168885-0.post@n6.nabble.com> <1507361366470-0.post@n6.nabble.com> From: Alexey Kukushkin Date: Tue, 10 Oct 2017 20:55:06 +0300 Message-ID: Subject: Re: Persistence store(MSSQL) using cross-platform c#(Ignite Client windows) and java(Ignite Server linux version) To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="001a1148f74ce3d816055b350191" archived-at: Tue, 10 Oct 2017 17:55:13 -0000 --001a1148f74ce3d816055b350191 Content-Type: text/plain; charset="UTF-8" Siva, JP, This approach to add cache configuration at runtime actually works!!! Just tested it: Assuming initially you have no caches:
This application adds a dynamic cache at runtime using XML configuration approach instead of code-based approach! class Program { private static Configuration appConfig = ConfigurationManager.OpenExeConfiguration(Environment.GetCommandLineArgs()[0]); static void Main(string[] args) { AddCacheConfiguration("dynamic-cache-1"); using (IIgnite ignite = Ignition.StartFromApplicationConfiguration()) { ignite.GetCache("dynamic-cache-1"); } } public static void AddCacheConfiguration(string name) { const string IgniteNS = " http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection"; var appConfigPath = Environment.GetCommandLineArgs()[0] + ".config"; var appConfig = XDocument.Load(appConfigPath); var cachesConfig = appConfig .Element("configuration") .Element(XName.Get("igniteConfiguration", IgniteNS)) .Element(XName.Get("cacheConfiguration", IgniteNS)); var cacheConfig = new XElement(XName.Get("cacheConfiguration", IgniteNS)); cacheConfig.Add(new XAttribute("name", name)); cachesConfig.Add(cacheConfig); appConfig.Save(appConfigPath); } } --001a1148f74ce3d816055b350191 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Siva, JP,

This approach to add cache co= nfiguration at runtime actually works!!! Just tested it:

Assuming initially you have no caches:

<?xml version=3D"1.0" encoding=3D"utf-8"?>
=
<configuration>
=C2=A0 <configSections>
=C2=A0 =C2=A0 <section name=3D"igniteConfiguration" type=3D&= quot;Apache.Ignite.Core.IgniteConfigurationSection, Apache.Ignite.Core"= ; />
=C2=A0 </configSections>
=C2=A0 <ignit= eConfiguration xmlns=3D"http://ignite.apache.org/schema/dotnet/Igni= teConfigurationSection" gridName=3D"myGrid1" clientMode= =3D"true">
=C2=A0 =C2=A0 <cacheConfiguration&= gt;
=C2=A0 =C2=A0 </cacheConfiguration>
= =C2=A0 </igniteConfiguration>
=C2=A0 <discoverySpi ... /= >
</configuration>

This a= pplication adds a dynamic cache at runtime using XML configuration approach= instead of code-based approach!

=C2=A0 =C2= =A0 class Program
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 private static Configuration appConfig =3D ConfigurationManager.Open= ExeConfiguration(Environment.GetCommandLineArgs()[0]);

=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 static void Main(string[] args)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 AddCacheConfiguration("dynamic-cache-1");

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 using (IIgnite ignite = =3D Ignition.StartFromApplicationConfiguration())
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ignite.GetCache<int, string>("dynamic-cache= -1");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0= =C2=A0 public static void AddCacheConfiguration(string name)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 const string IgniteNS =3D "http://ignite.apache.org/schema/dotn= et/IgniteConfigurationSection";
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 var appConfigPath =3D Environment.GetCommandLineArgs()[0]= + ".config";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= var appConfig =3D XDocument.Load(appConfigPath);
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 var cachesConfig =3D appConfig
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .Element("configurat= ion")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 .Element(XName.Get("igniteConfiguration", IgniteNS))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .Element(XName.Ge= t("cacheConfiguration", IgniteNS));
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 var cacheConfig =3D new XElement(XName.Get("c= acheConfiguration", IgniteNS));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 cacheConfig.Add(new XAttribute("name", name));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cachesConfig.Add(cacheConfi= g);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 appConfig.Save(appC= onfigPath);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0= }

--001a1148f74ce3d816055b350191--