Node js talking to PROGRESS PUG Norway 2013

  • Slides: 44
Download presentation
Node. js talking to PROGRESS PUG Norway 2013, Oslo 26 February 2021 Node. js

Node. js talking to PROGRESS PUG Norway 2013, Oslo 26 February 2021 Node. js talking to PROGRESS Page 1

§ § Introduction Node. js Mongo. DB PROGRESS connections 26 February 2021 Node. js

§ § Introduction Node. js Mongo. DB PROGRESS connections 26 February 2021 Node. js talking to PROGRESS Page 2

Introduction § Robert Prediger § 12 years experience in web development § 18 years

Introduction § Robert Prediger § 12 years experience in web development § 18 years experience in PROGRESS § robert. prediger@web 4 biz. de 26 February 2021 Node. js talking to PROGRESS Page 3

Web Client Middleware Backend Javascript Progress 26 February 2021 Node. js talking to PROGRESS

Web Client Middleware Backend Javascript Progress 26 February 2021 Node. js talking to PROGRESS Page 4

Node. js Few facts about Javascript: § 1995 Developed by Brendan Eich – –

Node. js Few facts about Javascript: § 1995 Developed by Brendan Eich – – The Best of Lisp The Worst C / Java syntax (Sun wanted this crap) The prototypical inheritance from Self In 12 days § 1999 Microsoft invented XMLHTTP § 2008 Release of Google Chrome and V 8 § 2009 Ryan Dahl invented Node. js 26 February 2021 Node. js talking to PROGRESS Page 5

Typescript class Student { fullname : string; constructor(public firstname, public middleinitial, public lastname) {

Typescript class Student { fullname : string; constructor(public firstname, public middleinitial, public lastname) { this. fullname = firstname + " " + middleinitial + " " + lastname; } } interface Person { firstname: string; lastname: string; } var user = new Student("Jane", "M. ", "User"); 26 February 2021 Node. js talking to PROGRESS Page 6

Node. js § What is Node. js – Server side Javascript – Built on

Node. js § What is Node. js – Server side Javascript – Built on Chrome V 8 Engine – Event-driven, non blocking I/O model § What is it for? – Easily building fast, scalable network applications – Perfect for data-intensive real-time application that run across distributed devices 26 February 2021 Node. js talking to PROGRESS Page 7

Node. js Blocking I/O § database, filesystem – disk § S 3, external APIs

Node. js Blocking I/O § database, filesystem – disk § S 3, external APIs – networking 26 February 2021 Node. js talking to PROGRESS Page 8

Node. js 26 February 2021 Node. js talking to PROGRESS Page 9

Node. js 26 February 2021 Node. js talking to PROGRESS Page 9

Node. js § F-18 Hornet – Max speed of 1, 190 mph § RAM

Node. js § F-18 Hornet – Max speed of 1, 190 mph § RAM 26 February 2021 § Banana slug – Max speed of 0. 007 mph § Hard disk Node. js talking to PROGRESS Page 10

Node. js Typical Request F = Fast F-18 Hornet S = Slow Banana Slug

Node. js Typical Request F = Fast F-18 Hornet S = Slow Banana Slug FSSSSSSSF 26 February 2021 Node. js talking to PROGRESS Page 11

Node. js Request 26 February 2021 Webserver Messenger Web. Speed Thread CGI Agent Node.

Node. js Request 26 February 2021 Webserver Messenger Web. Speed Thread CGI Agent Node. js talking to PROGRESS Page 12

Node. js DEFINE QUERY q. Cust FOR Customer. OPEN QUERY q. Cust FOR EACH

Node. js DEFINE QUERY q. Cust FOR Customer. OPEN QUERY q. Cust FOR EACH Customer. GET FIRST q. Cust. <next statement> 26 February 2021 Node. js talking to PROGRESS Page 13

Node. js § Request with Web. Speed: Finished request Green is executing thread Start

Node. js § Request with Web. Speed: Finished request Green is executing thread Start 2 nd request Red is waiting on I/O 26 February 2021 Node. js talking to PROGRESS Page 14

Node. js Web Apps § blocking I/O decreases concurrency 26 February 2021 Node. js

Node. js Web Apps § blocking I/O decreases concurrency 26 February 2021 Node. js talking to PROGRESS Page 15

Node. js 26 February 2021 Node. js talking to PROGRESS Page 16

Node. js 26 February 2021 Node. js talking to PROGRESS Page 16

Node. js Non Blocking I/O Model 26 February 2021 Node. js talking to PROGRESS

Node. js Non Blocking I/O Model 26 February 2021 Node. js talking to PROGRESS Page 17

Node. js § Request with Node: Reactor Request Green is executing thread Red is

Node. js § Request with Node: Reactor Request Green is executing thread Red is waiting on I/O 26 February 2021 Node. js talking to PROGRESS Page 18

Node. js Reactor Pattern Click Callbacks Browser Drag 26 February 2021 Callbacks Node. js

Node. js Reactor Pattern Click Callbacks Browser Drag 26 February 2021 Callbacks Node. js talking to PROGRESS Page 19

Node. js Event-Driven 26 February 2021 Node. js talking to PROGRESS Page 20

Node. js Event-Driven 26 February 2021 Node. js talking to PROGRESS Page 20

Node. js Evented Programming $(″body″). click( function() { $(this). css( ″color″, ″red″ ); });

Node. js Evented Programming $(″body″). click( function() { $(this). css( ″color″, ″red″ ); }); Event Callback 26 February 2021 Node. js talking to PROGRESS Page 21

Node. js Can handle thousands of concurrent connections with minimal overhead (CPU/Memory) on a

Node. js Can handle thousands of concurrent connections with minimal overhead (CPU/Memory) on a single Process! 26 February 2021 Node. js talking to PROGRESS Page 22

Node. js 26 February 2021 Node. js talking to PROGRESS Page 23

Node. js 26 February 2021 Node. js talking to PROGRESS Page 23

Node. js Summary § Extremely efficient networking applications § Fast javascript runtime (V 8)

Node. js Summary § Extremely efficient networking applications § Fast javascript runtime (V 8) § Rapid growth in both, packages and community 26 February 2021 Node. js talking to PROGRESS Page 24

Socket. io Introduction 26 February 2021 Node. js talking to PROGRESS Page 25

Socket. io Introduction 26 February 2021 Node. js talking to PROGRESS Page 25

Socket. io Protocol for having a bidirectional communication with client. 26 February 2021 Node.

Socket. io Protocol for having a bidirectional communication with client. 26 February 2021 Node. js talking to PROGRESS Page 26

Socket. io § Example server. js: var io = require('socket. io'). listen( 80 );

Socket. io § Example server. js: var io = require('socket. io'). listen( 80 ); io. sockets. on('connection', function (socket) { socket. emit( 'message', { text: 'Hello World' }); socket. on('chat', function (data) { socket. broadcast. emit(data); }); 26 February 2021 Node. js talking to PROGRESS Page 27

Socket. io § Example client. js: <script src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="/socket. io. js"></script> <script> var socket =

Socket. io § Example client. js: <script src="/socket. io. js"></script> <script> var socket = io. connect('http: //test. domain'); socket. on( 'message', function (data) { console. log(data); }); socket. emit( 'chat', { message: 'Hi' } ); </script> 26 February 2021 Node. js talking to PROGRESS Page 28

Node. js Demo 26 February 2021 Node. js talking to PROGRESS Page 29

Node. js Demo 26 February 2021 Node. js talking to PROGRESS Page 29

Mongo. DB 26 February 2021 Node. js talking to PROGRESS Page 31

Mongo. DB 26 February 2021 Node. js talking to PROGRESS Page 31

Mongo. DB § Document oriented § JSON-like – BSON • Basically typed JSON •

Mongo. DB § Document oriented § JSON-like – BSON • Basically typed JSON • Number, string, binary, array, subdocuments, etc. § Ad-hoc query support – db. products. find( { name: „Bob“ } ) 26 February 2021 Node. js talking to PROGRESS Page 32

Mongo. DB { _id: ´rp´, name: ´robert´, address: { street: ´Butterfeld 1´, zip: 85368,

Mongo. DB { _id: ´rp´, name: ´robert´, address: { street: ´Butterfeld 1´, zip: 85368, city: ´Wang´, country: ´Germany´ }, interests: [ ´Node´, ´Progress´ ] } 26 February 2021 Node. js talking to PROGRESS Page 33

Mongo. DB § § § Extremely fast Dynamic schemas Vertical and horizontal scalable Map/Reduce

Mongo. DB § § § Extremely fast Dynamic schemas Vertical and horizontal scalable Map/Reduce Aggregation Framework § No joins § No transactions – use document level $atomics 26 February 2021 Node. js talking to PROGRESS Page 34

Mongo. DB Javascript database Javascript client Javascript application ABL App. Server 26 February 2021

Mongo. DB Javascript database Javascript client Javascript application ABL App. Server 26 February 2021 Node. js talking to PROGRESS Page 35

Progress Communication between Progress and Node. js 26 February 2021 Node. js talking to

Progress Communication between Progress and Node. js 26 February 2021 Node. js talking to PROGRESS Page 36

Progress HTTP 26 February 2021 Node. js talking to PROGRESS Page 37

Progress HTTP 26 February 2021 Node. js talking to PROGRESS Page 37

Progress Webservice 26 February 2021 Node. js talking to PROGRESS Page 38

Progress Webservice 26 February 2021 Node. js talking to PROGRESS Page 38

Progress var soap = require('soap'), url = 'http: //www. thomas-bayer. com/ax… args = {

Progress var soap = require('soap'), url = 'http: //www. thomas-bayer. com/ax… args = { blz: '74369662' }; soap. create. Client( url, function( err, client ) { client. get. Bank( args, function(err, result) { console. log( err, result ); }); 26 February 2021 Node. js talking to PROGRESS Page 39

Progress TCP 26 February 2021 Node. js talking to PROGRESS Page 40

Progress TCP 26 February 2021 Node. js talking to PROGRESS Page 40

Progress Messaging AMQP (Advanced Messaging Queuing Protocol) AMQP is the Internet Protocol for Business

Progress Messaging AMQP (Advanced Messaging Queuing Protocol) AMQP is the Internet Protocol for Business Messaging 26 February 2021 Node. js talking to PROGRESS Page 41

Progress Direct connect via node 4 progress Bridge for connecting Node. js and Progress

Progress Direct connect via node 4 progress Bridge for connecting Node. js and Progress directly https: //github. com/Robert. Prediger/node 4 progress 26 February 2021 Node. js talking to PROGRESS Page 42

Progress REST 26 February 2021 Node. js talking to PROGRESS Page 43

Progress REST 26 February 2021 Node. js talking to PROGRESS Page 43

Progress var rest = require('rest'); rest. post( 'http: //service. com/action', { data: 334 }).

Progress var rest = require('rest'); rest. post( 'http: //service. com/action', { data: 334 }). on('complete', function(data, response) { if (response. status. Code == 201) { . . . } }); 26 February 2021 Node. js talking to PROGRESS Page 44

Questions? robert. prediger@web 4 biz. de 26 February 2021 Node. js talking to PROGRESS

Questions? robert. prediger@web 4 biz. de 26 February 2021 Node. js talking to PROGRESS Page 45