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 35270200B8D for ; Fri, 23 Sep 2016 10:28:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 33B5D160ACA; Fri, 23 Sep 2016 08:28:44 +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 542DB160AC2 for ; Fri, 23 Sep 2016 10:28:43 +0200 (CEST) Received: (qmail 74318 invoked by uid 500); 23 Sep 2016 08:28:42 -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 74309 invoked by uid 99); 23 Sep 2016 08:28:42 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2016 08:28:42 +0000 Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 30A4F1A024A for ; Fri, 23 Sep 2016 08:28:42 +0000 (UTC) Received: by mail-oi0-f45.google.com with SMTP id w11so126683738oia.2 for ; Fri, 23 Sep 2016 01:28:42 -0700 (PDT) X-Gm-Message-State: AE9vXwPwUPUeb5QAAujhzO6u3o2t6ORSjq7zraOAEwSqdxZNN2Uq0FyoJ3Olb2BZvbNGot1L5GseexA5zOUYOuZU X-Received: by 10.202.88.65 with SMTP id m62mr8960647oib.7.1474619321401; Fri, 23 Sep 2016 01:28:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.38.178 with HTTP; Fri, 23 Sep 2016 01:28:10 -0700 (PDT) In-Reply-To: References: From: Pavel Tupitsyn Date: Fri, 23 Sep 2016 11:28:10 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Ignite inside OData WebAPI To: user@ignite.apache.org Content-Type: multipart/alternative; boundary=001a113d2c02d4d904053d2890d8 archived-at: Fri, 23 Sep 2016 08:28:44 -0000 --001a113d2c02d4d904053d2890d8 Content-Type: text/plain; charset=UTF-8 Hi, 1) The code looks good to me. What exactly is the issue? Is there an exception, or do you get incorrect results? 2) There is a known issue with IIS: it performs a shadow-copy [1] of application assemblies (dll files), which makes it impossible for Ignite to detect Libs directory with jar files. If your libs directory is in bin folder (as it is when NuGet is used), the solution is the following [2]: IgniteConfiguration.JvmClasspath = Directory.GetFiles(Server.MapPath(@"~\bin\libs")).Aggregate((x, y) => x + ";" + y); Let me know if this helps. [1] https://msdn.microsoft.com/en-us/library/ms404279(v=vs.110).aspx [2] https://apacheignite-net.readme.io/docs/aspnet-output-caching#configuration-starting-ignite-manually On Fri, Sep 23, 2016 at 6:02 AM, Murthy Kakarlamudi wrote: > Hi, > I am trying to expose Cache contents as an Odata API. I created the > Odata API using ASP.NET WebAPI. Inside the API implementation, I am > initializing Ignite in cache mode. Below is the method I am using to > retrieve a listing. I have 2 questions. > > 1. I was not able to use Select option in AsCacheQueryable. How to get a > list of all the entries in the cache from LINQ? > 2. Embedded IIS server quits the process after it hits var ignite = > Ignition.Start(cfg); statement. Processing stops beyond this statement. I > confirmed this in debug mode. It does not throw any errors in the console. > Not sure if it is possible to start Ignite in client mode in Web API that > is deployed on IIS. > > Any help will be much appreciated. Thanks. > > public List GetMovies() > { > var cfg = new IgniteConfiguration > { > BinaryConfiguration = new Apache.Ignite.Core.Binary. > BinaryConfiguration(typeof(Movie), typeof(StarRating), typeof(Person)), > JvmOptions = new List { "-Xms512m", "-Xmx1024m" } > }; > Ignition.ClientMode = true; > var ignite = Ignition.Start(cfg); > var cache = ignite.GetOrCreateCache(new > CacheConfiguration > { > Name = "myMusicCache", > QueryEntities = new[] > { > new QueryEntity(typeof(int), typeof(Movie)) > > } > }); > List movies = new List(); > IQueryable> qry = > cache.AsCacheQueryable().Where(m => m.Key == 1); > > foreach (ICacheEntry entry in qry) > { > Console.WriteLine("Movie: " + entry.Value); > movies.Add(entry.Value); > } > > > return movies; > } > --001a113d2c02d4d904053d2890d8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

1) The code looks good to me. What = exactly is the issue? Is there an exception, or do you get incorrect result= s?
2) There is a known issue with IIS: it performs a shadow-copy = [1] of application assemblies (dll files), which makes it impossible for Ig= nite to detect Libs directory with jar files.
If your libs direct= ory is in bin folder (as it is when NuGet is used), the solution is the fol= lowing [2]:

IgniteConfiguration.JvmClasspath =3D D= irectory.GetFiles(Server.MapPath(@"~\bin\libs")).Aggregate((x, y)= =3D> x + ";" + y);

Let me know if th= is helps.


[2] https://apacheignite-net.readme.io/docs= /aspnet-output-caching#configuration-starting-ignite-manually

On Fri, Sep 23,= 2016 at 6:02 AM, Murthy Kakarlamudi <ksatya@gmail.com> wrote= :
Hi,
=C2=A0 =C2=A0I= am trying to expose Cache contents as an Odata API. I created the Odata AP= I using ASP.NET WebAPI. In= side the API implementation, I am initializing Ignite in cache mode. Below = is the method I am using to retrieve a listing. I have 2 questions.

1. I was not able to use Select option in AsCacheQueryabl= e. How to get a list of all the entries in the cache from LINQ?
2= . Embedded IIS server quits the process after it hits var ignite =3D Igniti= on.Start(cfg); statement. Processing stops beyond this statement. I confirm= ed this in debug mode. It does not throw any errors in the console. Not sur= e if it is possible to start Ignite in client mode in Web API that is deplo= yed on IIS.

Any help will be much appreciated. Tha= nks.

public List<Movie> GetMovies()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 var cfg =3D new IgniteConfiguration
=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 BinaryConfiguration =3D new Apache.Ignite.Core.Binary.= BinaryConfiguration(typeof(Movie), typeof(StarRating), typeof(Per= son)),
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Jv= mOptions =3D new List<string> { "-Xms512m", "-Xmx1024m= " }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 };
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ignition.ClientMode =3D true;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 var ignite =3D Ignition.St= art(cfg);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 var cache =3D= ignite.GetOrCreateCache<int, Movie>(new CacheConfiguration
=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 Name =3D "myMusicCache",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 QueryEntities= =3D new[]
=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 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 new QueryEntity(typeof(int), typeof(Movie))

=
=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 =C2=A0 =C2=A0 });
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 List<Movie> movies =3D new List<= ;Movie>();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IQueryabl= e<ICacheEntry<int, Movie>> qry =3D
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cache.AsCacheQueryable().Where(= m =3D> m.Key =3D=3D 1);

=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 foreach (ICacheEntry<int, Movie> entry in qry)
=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 Console.WriteLine("Movie= : " + entry.Value);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 movies.Add(entry.Value);
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 }


=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return movies;
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

--001a113d2c02d4d904053d2890d8--