Java EE and NoSQL using JBoss EAP 7 and OpenShift
-
Upload
arun-gupta -
Category
Technology
-
view
801 -
download
4
Transcript of Java EE and NoSQL using JBoss EAP 7 and OpenShift
![Page 1: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/1.jpg)
Java EE and NoSQL using
JBoss EAP 7 and
OpenShiftArun Gupta, @arungupta
Matt Ingenthron, @ingenthr
![Page 2: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/2.jpg)
• Java EE 7 and Java SE 8
• Optimized for containers & cloud
• Enhanced admin & monitoring
• DevOps productivity
![Page 3: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/3.jpg)
DEVELOPER PRODUCTIVITY
MEETING ENTERPRISE DEMANDS
Java EE 7
! Batch ! Concurrency ! Simplified JMS
! More annotated POJOs ! Less boilerplate code ! Cohesive integrated
platform ! WebSockets ! JSON ! Servlet 3.1 NIO ! REST
![Page 4: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/4.jpg)
Top 10 Java EE 7 features• WebSocket endpoints
• Batch Applications
• JSON Processing
• Concurrency Utilities
• Simplified JMS API
• Transactions in POJO
• JAX-RS Client API
• Default Resources
• More annotated POJOs
• Faces Flow
![Page 5: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/5.jpg)
Optimized for Container & Clouds• Low-memory footprint, faster startup and higher density
• OpenShift Container support
• Highly scalable Web Server (Undertow)
• Non/blocking I/O
• Port reduction
• HTTP/2, WebSockets, …
![Page 6: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/6.jpg)
Enhanced Admin & Monitoring• Faster, simpler, intuitive web console
• Powerful CLI
• Server suspend/Graceful shutdown
![Page 7: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/7.jpg)
Types of NoSQL databases
• Key/Value
• Document
• Graph
• Columnar
![Page 8: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/8.jpg)
NoSQL Databases: Key-Value
Key Value
Email [email protected]
Profile { “name”: “Bob”, “location”: “Mountain View, CA”}
Logo
![Page 9: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/9.jpg)
NoSQL Databases - Document
{ “name”: “Erlich”, “location”: “Mountain View, CA”, “like”: [ “running”, “reading”, “music” ]}
{ “name”: “Gilfoyle”, “location”: “Mountain View, CA”, “like”: [ “running”, “reading”, “music” ]}
{ “name”: “Dinesh”, “location”: “Mountain View, CA”, “like”: [ “running”, “reading”, “music” ]}
{ “name”: “Richard”, “location”: “Silicon Valley”, “like”: [ “running”, “reading”, “music” ]}
![Page 10: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/10.jpg)
NoSQL Databases - Columnar
Row Column1
JK Rowling
Harry Potter and the Philosopher’s
Stone
Column2
Author Title Year of Release
Harry Potter and the Chamber of Secrets
Harry Potter and the NoSQL Journey
1997
1998
2016
![Page 11: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/11.jpg)
NoSQL Databases - Graph
Richard Hendricks
Pied Piper
Erlich Bachman
Houseownsworks
founded part-owner
friends
![Page 12: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/12.jpg)
©2016 Couchbase Inc.
NoSQL catalog
12
Key-Value
Memcached
Cac
he
(mem
ory
only
)D
atab
ase
(mem
ory/
disk
)
Redis
Data Structure
Riak
Couchbase
MongoDB
Document Column
Cassandra
Graph
Neo4j
HBase InfiniteGraph
Coherence
Membase
![Page 13: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/13.jpg)
©2016 Couchbase Inc.
What is Couchbase?
13
Managed'Cache Key-Value'Store Document'Database Embedded'Database Sync'Management
![Page 14: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/14.jpg)
©2016 Couchbase Inc.
Couchbase Developer
14
![Page 15: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/15.jpg)
©2016 Couchbase Inc.
Couchbase and BigData
15
![Page 16: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/16.jpg)
©2016 Couchbase Inc.
Cross-‐data Center Replication (XDCR)
16
![Page 17: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/17.jpg)
©2016 Couchbase Inc.
▪Declarative query language that extends SQL for JSON
▪SELECT, INSERT, UPDATE, DELETE, MERGE, EXPLAIN
▪Sort, filter, transform, group, and combine/join data
▪Query data via language integration
17
![Page 18: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/18.jpg)
©2016 Couchbase Inc.
▪JSON documents – Rich structure – Structure evolution
▪SQL – General query functionality – Query across relationships
▪Why N1QL? – Developers already know SQL – No need for complex query frameworks
18
![Page 19: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/19.jpg)
©2016 Couchbase Inc.
SELECT name, code FROM `beer-sample` WHERE city = 'San Francisco' AND type = 'brewery';
19
SELECT DISTINCT brewery_id FROM `beer-sample` WHERE brewery_id IS NOT MISSING ORDER BY brewery_idLIMIT 5;
![Page 20: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/20.jpg)
©2016 Couchbase Inc.
Couchbase Java SDK//connect to the clusterCouchbaseCluster cluster = CouchbaseCluster.create("localhost");
//open a bucketBucket bucket = cluster.openBucket(“bucket", "password");
//create JSON and a documentJsonObject json = JsonObject.create().put("name", "John");JsonDocument doc = JsonDocument.create("key1", json);
//store the documentbucket.insert(doc);
20
![Page 21: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/21.jpg)
©2016 Couchbase Inc.
Access NoSQL using JDBC▪JDBC driver for accessing Couchbase ▪Run N1QL queries ▪Get JSON data through standard JDBC interfaces ▪JSON types supported
– Simple values (string, numbers, boolean, …) – Compound (objects, arrays, …)
▪Users – BI/ETL Tools (Tableau, Informatica, …) – Persistence providers (EclipseLink, Hibernate, …)
▪github.com/jdbc-json/jdbc-cb21
![Page 22: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/22.jpg)
©2016 Couchbase Inc.
Getting Started with JDBC Driver
<dependency>
<groupId>com.couchbase.jdbc</groupId>
<artifactId>jdbc-n1ql</artifactId>
<version>1.0-BETA</version>
</dependency>
22
![Page 23: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/23.jpg)
©2016 Couchbase Inc.
Accessing Couchbase using JDBCpackage com.couchbase.jdbc.examples;
import java.sql.*;
public class SimpleVerification {
public static void main(String[] args) throws Exception {
Connection con = DriverManager.getConnection("jdbc:couchbase://localhost:8093");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select name, code from `beer-sample` " +
"where city = 'San Francisco' and type = 'brewery'");
while (rs.next()) {
String name = rs.getString("name");
String code = rs.getString("code");
System.out.println("name: " + name + ", code: " + code);
}
}
}
23
![Page 24: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/24.jpg)
©2016 Couchbase Inc.
Hibernate OGM
▪Power and simplicity of JPA for NoSQL databases ▪Currently supported
– Key/value: Infinispan, Ehcache – Document: MongoDB, Couchbase – Graph: Neo4J
▪hibernate.org/ogm
24
![Page 25: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/25.jpg)
![Page 26: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/26.jpg)
Community Powered Innovation
![Page 27: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/27.jpg)
OpenShift 3
![Page 28: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/28.jpg)
©2016 Couchbase Inc. 28
![Page 29: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/29.jpg)
©2016 Couchbase Inc.
▪Technical readiness for OpenShift
▪First and only NoSQL database primed for OpenShift
29
![Page 30: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/30.jpg)
©2016 Couchbase Inc.
OpenShift All-‐in-‐One VM
30
![Page 31: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/31.jpg)
©2016 Couchbase Inc. 31
![Page 32: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/32.jpg)
©2016 Couchbase Inc. 32
![Page 33: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/33.jpg)
©2016 Couchbase Inc.
WildFly Swarm
▪Package and run Java EE applications ▪Just enough of the server runtime ▪Creates an über JAR ▪Integrated stack
– Single sign-on using Keycloak – Monitoring using Hawkular – Swagger – Netflix OSS stack - Hystrix, Turbine, …
33
![Page 34: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/34.jpg)
©2016 Couchbase Inc.
Java EE Microservices Stack
34
https://github.com/arun-gupta/wildfly-swarm-couchbase
![Page 35: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/35.jpg)
©2016 Couchbase Inc. 35
@Path("airline")public class AirlineResource { @Inject Database database; @GET public String getAll() { N1qlQuery query = N1qlQuery.simple("SELECT * FROM `travel-sample` LIMIT 10"); N1qlQueryResult result = database.getBucket().query(query); return result.allRows().toString(); }}
@Singleton@Startuppublic class Database { CouchbaseCluster cluster; public CouchbaseCluster getCluster() { return CouchbaseCluster.create(“localhost”); } public Bucket getBucket() { return getCluster().openBucket("travel-sample"); }}
![Page 36: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/36.jpg)
©2016 Couchbase Inc.
Demo36
![Page 37: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/37.jpg)
©2016 Couchbase Inc.
References
▪JBoss EAP: jboss.org/products/eap ▪OpenShift: openshift.com ▪Getting Started with NoSQL: couchbase.com/get-started-developing-nosql ▪Couchbase Developer Portal: developer.couchbase.com ▪N1QL interactive tutorial: query.pub.couchbase.com/tutorial/
37
![Page 38: Java EE and NoSQL using JBoss EAP 7 and OpenShift](https://reader033.fdocuments.in/reader033/viewer/2022051501/58a109321a28ab4b658b45b3/html5/thumbnails/38.jpg)
©2016 Couchbase Inc.