Configuration Manager - JanusGraph Reference - Local Access

This page has been generated by maven-confluence-plugin


Table Of Content

Use JanusGraph Embedded

Below the necessary steps to setup JanusGraph embedded and accessing it through a spring application

Declare Maven dependencies

Access to Cassandra using open source driver

<dependency>
  <groupId>com.wba.configurationmanager-library</groupId>
  <artifactId>cfgmgr-janus-spring</artifactId>
  <version>3.2-SNAPSHOT</version>
</dependency>

<!-- THIS ENABLE ACCESS TO CASSANDRA -->
<dependency>
    <groupId>org.janusgraph</groupId>
    <artifactId>janusgraph-cql</artifactId>
    <version>0.3.0-20180813</version>
    <scope>runtime</scope>          
</dependency>

Access to Cassandra using DSE Driver enabling LDAP access

<dependency>
  <groupId>com.wba.configurationmanager-library</groupId>
  <artifactId>cfgmgr-janus-spring</artifactId>
  <version>3.2-SNAPSHOT</version>
</dependency>

<!-- THIS ENABLE ACCESS TO CASSANDRA -->
<dependency>
    <groupId>org.janusgraph</groupId>
    <artifactId>janusgraph-cql</artifactId>
    <version>0.3.0-20180813-</version>
    <scope>runtime</scope>          
    <exclusions>
       <exclusion>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
       </exclusion>
    </exclusions>            
</dependency>

<dependency>
   <groupId>com.datastax.dse</groupId>
   <artifactId>dse-java-driver-core</artifactId>
   <version>[1.4.1,)</version>
</dependency>

Use in Spring

Create an instance of JANUSGraphLocalSession

@SpringBootApplication
public class JanusLocalPocApplication  {

    private static final Logger LOGGER = LoggerFactory.getLogger(JanusLocalPocApplication.class);

    @Autowired()
    JANUSGraphLocalSession session;

    public static void main(String[] args) {
        SpringApplication.run(JanusLocalPocApplication.class, args);
    }

    @PostConstruct
    void init() {
      // Use graph traversal
      LOGGER.debug( "number of vertex(s): {}", session.G().V().count().next() );

    }
}

Configure spring application
In the application properties we have to set the URL of Janus configuration file

janus.config.url=classpath:janus-cql.properties

Janus Graph configuration for accessing to Cassandra

#
# file: janus-cql.properties
#
gremlin.graph=org.janusgraph.core.JanusGraphFactory

storage.backend=cql
# storage.backend=inmemory // useful for test

storage.cql.keyspace=_keyspace_
storage.cql.read-consistency-level=LOCAL_QUORUM
storage.cql.write-consistency-level=LOCAL_QUORUM

storage.hostname=_cassandra_host_
storage.username=_username_
storage.password=_password_



Labels

rx rx Delete
configuration configuration Delete
graphdb graphdb Delete
janusgraph janusgraph Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.