8 Replies Latest reply on Jul 24, 2013 1:38 PM by ssarabun

    Integrating Apache Cassandra into JBOSS AS - how?

    baecks Newbie

      Hello,

       

      I'd need to integrate Apache Cassandra with my JEE application running on JBOSS AS 7. I've been searching the web on how this is done best. I found a number of suggestions, but none of these seems to fit for a production environment or flexible enough:

      - using a JDBC driver for Cassandra, set up a datasource in JBOSS AS and use e.g. Hibernate JPA.

      - using the HECTOR API from my code and handle everything in my own code.

      - use INFINISPAN with Cassandra as second level cache (not even sure how/if this works).

       

      If anybody has experience with this, I'd appreciate if you could share your knowledge. I'm looking for recommendations, patterns, guidelines and best practices.

       

      Regards,

      Sven.

        • 1. Re: Integrating Apache Cassandra into JBOSS AS - how?
          baecks Newbie

          Answering my own question after further investigation.

           

           

          - Kundera JPA: This libray provides a JPA implementation for CASSANDRA. I review the library and it seems not to be production ready. I was also unable to find referenced to production systems based on Kundera.

          - HECTOR: This library is used is various production platforms. HECTOR now also includes JPA-alike (not 100% JPA compliant) entity management functionality. This library works fine and the entity management functionality performs nicely as well (in a JAVA SE application). Integrating this into JBOSS AS however failed. I could not make it work, due to incompatibilities between the HECTOR libraries (+ dependencies) and the JBOSS AS 7.x libraries.

          - ASTYANAX: Recently Netflix open-sourced their client library for cassandra. Given the library has been used for several years by Netflix, I'm rather confident of the stability. I ran some experiments with the library (JEE app running on JBOSS AS 7.x) and the library performs fine. The API is client and very feature rich (evoluation out of HECTOR, but very very different from HECTOR now).

           

          So, my conclusion is to go for ASTYANAX: https://github.com/Netflix/astyanax.

           

          Sven.

          • 2. Re: Integrating Apache Cassandra into JBOSS AS - how?
            Benjamin Seyinbour Expert

            "I ran some experiments with the library (JEE app running on JBOSS AS 7.x) and the library performs fine"

             

             

            I have tried Hector on JBoss without success, then I found Astyanax and Cassandra-jdbc. I find Astyanax less complicated and clean than Hector but I am still lost as to how one might integrate it with JBOSS. This was why I was so glad to see your comments above.

             

            I have the following top issues:

             

            1. Setting up Astyanax to integrate with JBOSS.
            2. Use Astyanax to create DAO EJB  Stateless bean.

             

            Thanks

            • 3. Re: Integrating Apache Cassandra into JBOSS AS - how?
              Vivek Mishra Newbie

              Kundera JPA: This libray provides a JPA implementation for CASSANDRA. I review the library and it seems not to be production ready. I was also unable to find referenced to production systems based on Kundera.

               

              <Vivek> Could you please share specific set of features which this library is missing and is not production ready? I can recall that there are some instances that people are moving into production systems. </vivek>

               

              -Vivek

              • 4. Re: Integrating Apache Cassandra into JBOSS AS - how?
                baecks Newbie

                Hi ebross,

                 

                I use Eclipse/Maven to integrate Astyanax into my project. Simply create e.g. a dynamic web application and put in the following Maven POM:

                 

                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                <modelVersion>4.0.0</modelVersion>

                <groupId>Astyanaxtest</groupId>

                <artifactId>Astyanaxtest</artifactId>

                          <version>0.0.1-SNAPSHOT</version>

                          <name>ASTYANAXTEST</name>

                <dependencies>

                  <dependency>

                                              <groupId>com.netflix.astyanax</groupId>

                  <artifactId>astyanax</artifactId>

                  <version>1.0.3</version>

                  </dependency>

                </dependencies>

                </project>


                For example code, just have a look in the Astyanax documentation: https://github.com/Netflix/astyanax/wiki.

                 

                Regards,

                Sven.

                • 5. Re: Integrating Apache Cassandra into JBOSS AS - how?
                  baecks Newbie

                  Hi Vivek,

                   

                  Kundera JPA attempts to provide a JPA implementation on top of Cassandra. JPA was design with SQL databases in mind. Given that Cassandra is fundamentally different from typical SQL databases, I believe using JPA for accessing Cassandra is not the right way. It's for sure a good solution for certain projects (e.g. migrating existing JPA based apps to Cassandra as datastore), but if you really want to take advantage of the rich feature set of Cassandra (tunable consistency, optimized reading/writing etc) I believe a dedicated access layer is required.

                   

                  Also I couldn't find any reference of Kundera being used in a production deployment. Astyanax on the other hand has Netflix as an excellent reference.

                   

                  Regards,

                  Sven.

                  • 6. Re: Integrating Apache Cassandra into JBOSS AS - how?
                    Vivek Mishra Newbie

                    Hi Sven,

                    It is a very valid point. Thought of fitting an ORM solution in nosql is not straightforward. w.r.t feature set of cassandra, yes these are something Kundera team is working upon. I will share an update on such feature support over cassandra,Mongo and HBase.  Next release will definitly fit in all such requirements.

                     

                    There are some instances where people are developing apps using Kundera. But yes, w.r.t NetFlix answer is NO

                     

                    Thanks for your valuable comments.

                     

                    -Vivek

                    • 7. Re: Integrating Apache Cassandra into JBOSS AS - how?
                      Benjamin Seyinbour Expert

                      Hi baecks,

                       

                      Thanks for your response. I am not a fan of maven; and beside this, our in-house development guidelines forbid it.  Also my original comment or request was in response to your solution to your own problem i.e., “integrate Apache Cassandra with my JEE application running on JBOSS “. It is this solution that I am interesting in.

                       

                      Astyanax is unlike JPA, which is managed by the EE container, and so I am particularly interested to know how you successfully integrated and deployed it in JBoss.

                       

                      Thanks.

                      • 8. Re: Integrating Apache Cassandra into JBOSS AS - how?
                        ssarabun Newbie

                        I know another solution: http://code.google.com/p/cassandra-jca/wiki/JBoss56

                        The cassandra-jca supports JBoss 7 too. And examples locates into git repository,  but now the documentation for JBoss 7 is not available.