Date post: | 31-May-2015 |
Category: |
Technology |
Upload: | tyler-band |
View: | 200 times |
Download: | 3 times |
Page 1
A Shot of Espresso for Your Enterprise Apps
Espresso Logic
Fastest & Easiest Way to Create Backend Services across all data sources
Espresso Logicpresents
"How to integrate MongoDB and SQL data with a single REST API"
Page 3
Heterogeneous world of data Use Cases for MongoDB & SQL SQL vs Mongo concepts REST as an enterprise standard Building a secure REST Integration Server Creating Custom API endpoints Blending MongoDB with SQL Q&A
Agenda
The Heterogeneous world of data
• SQL• JSON• EDI• CSV• XML• SOAP• ODATA
<book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre></book>
<workspace><atom:title>Default</atom:title><collection href="Categories"><atom:title>Categories</atom:title></collection><collection href="CustomerDemographics"><atom:title>CustomerDemographics</atom:title></collection><collection href="Customers"><atom:title>Customers</atom:title></collection>
SQL vs MongoDB Concepts
SQL Terms/concepts MongoDB Terms/concepts
DATABASE DATABASE
TABLE COLLECTION
ROW DOCUMENT OR BSON DOCUMENT
COLUMN FIELD
INDEX INDEX
TABLE JOINS EMBEDDED DOCUMENTS AND LINKING
PRIMARY KEY PRIMARY KEY
TRANSACTIONS BEGIN, COMMIT/ROLLBACK
NA
SCHEMA NA
Page 6
Language Syntax is different
SQL Terms, Function, Concepts MongoDB Aggregation Operators
WHERE $match
GROUP BY $group
HAVING $match
SELECT $project
ORDER BY $sort
LIMIT $limit
SUM $sum
COUNT $count
JOIN No direct support
Use Cases for MongoDB & SQL
• MongoDB – Storing archival and log
data– Product and Image catalogs– Content Management – BI - Big Data– New Mobile Apps (high
volume reads)
• SQL Database– ACID Transactions– Updates to multiple tables
in single transaction– Financial and Accounting
Use Case for MongoDB and SQL
SQL and MongoDB– Financial and Sales transactions with archived history– Account and Payment Processing– Shopping Carts and Order Entry
REST as an Enterprise standard
http://eval.espressologic.com/rest/sample/demo/v1/
Endpoints: /customer/{id}/employee/{id}/customerWithOrders/product/{id}
{
“@metadata": {"checksum": "A:6c253d56830572ea",
}, "name": "Alpha and Sons", "balance": 0, "credit_limit": 9000 }
Need to build a REST Server
Apache TomcatHibernate (JPA)Spring MVCJDBC and Driver for SQLJersey/Jackson annotationsLogging Library (log4J)Web HostingServlet APIIdentity Security servicesJavaScript runtime engine
Building a secure REST Integration Server
metadata
PropertiesUser & roles definitions, SQL and NoSQL Server connectionsDeclarative (Reactive) RulesRole-based Access ControlSchema ORM ModelSecurity tokensREST API definitionsEvent CodeHard W
ay
The Easy Way (and the fastest)
SQL
“
name": "Alpha and Sons", "balance": 4484, "MongoOrders": [ { "_id": { "$oid": "53d64c59a32268822c09e994" }, "order_number": 1, "amount_total": 1079, "salesrep_id": 2, "items": [ { "_id": { "$oid": "53d64c38a32268822c09e746" }, "lineitem_id": 1, "product_number": 4, "amount": 600 },
Instant REST API
Espresso Logic Architecture
Complete On-premise VM Appliance or Cloud Managed Service
Step 1 – Connect Existing SQL Database
• SQL Server• Oracle• Azure SQL• MySQL• PostgreSQL• NuoDB• Generic JDBC
SQL
Instant RESTful Endpoints• Tables• Views• Stored Procedures
Step 2- Creating Custom API endpoints
1. Name a new resource
2. Specify the SQL table
(optional)Add sub-documents
Step 3- Blending MongoDB with SQL
Point and Click1. Select Parent SQL2. Add Sub
Document3. Enter MongoDB
Server, database, and collection
4. Specify ‘join’
Test in REST Lab
Step 4 – Customize your API
• Alias Attributes (rename)
• Change format• Select/Project
columns to include• Add new virtual
columns (Row Event)
• Filter/Sort • Limit/Offset
(paging)
Test REST Lab to Blended API
What’s Next
• Adding Authentication to your new REST Server• Setting up users and roles• Assigning security access Roles (Read, Insert,
Update, Delete)• Column and Row level security• Business Logic (Reactive Programming)• Event Model (JavaScript)
Summary