node.js and oracle db - pub/sub with redis
Post on 16-Apr-2017
5.239 Views
Preview:
TRANSCRIPT
Introducing a New Product
Node.js access to Oracle Db
Node.js does not have Oracle db access at this time. It does have MS Sql, Postres, MySql & SqlLite and others of the NoSQL flavor.
This is a proof of concept that demonstrates how node.js can leveage the power of Oracle db by incorporating a pub sub solution provided by Redis.
Data in 4 Easy Steps
Node pub/sub with RedisJava pub/sub with RedisJava does query with message from NodeJava publishes result setAsync provides patterns for control flow
PubPubSub
Sub
Query
Java client receives a message containing the text to a query or stored procedureIt processes the message by performing the requestIt returns the Result as a JSONArray of Jason Objects.
Lines 4 9, create 2 pairs of pub/sub clientsLine 12-13, 15-16, when ready, subscribe to the results which is the JSONArray of JSONObjects
Node.js
For query and storedProc, when a message is received, send it to the cb callback provided by Async.Publish the query or storedProc that was passed .
Node.js
When processing is complete the node client ends the sub / pub connection.
Node.js
Async provides parallel control flow. On line 10, the query function publishes it's message as does the storedProc function on line 24.
Node.js test client
Continuing...Parallel control calls the anonymous function on line 32. The results obj contains the JSONArray data. After logging the results, the pub / sub is ended.
Node.js test client
All open source.
For complete write up see
http://barton-notestomyself.blogspot.com/2011/12/nodejs-oracle-db-not-so-bad-union.html
Node.js Oracle db Pub/Sub
top related