extending jms over the web with html5...

34
1 Copyright © 2012 – Kaazing Corporation Extending JMS over the Web with HTML5 WebSocket

Upload: others

Post on 20-Jun-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

1! Copyright © 2012 – Kaazing Corporation

Extending JMS over the Web with HTML5 WebSocket

Page 2: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

2! Copyright © 2012 – Kaazing Corporation

What we are going to cover…

• Quick Overview of HTML5 • What is a WebSocket? • Very Quick Review of JMS • Extending JMS over the Web • How to Become Famous, Gain Wealth, Have 1M+ FB Friends and be an Overall AwesomePerson™

Page 3: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

3! Copyright © 2012 – Kaazing Corporation

First of all…

Overview of HTML5

Page 4: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

4! Copyright © 2012 – Kaazing Corporation

•  Focused on Web Applications

•  Web apps are rapidly becoming first class apps, on par with desktop and native apps

•  Collection of Technologies

•  Not just an upgrade to HTML4

What is “HTML5”?

Page 5: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

5! Copyright © 2012 – Kaazing Corporation

Why HTML5?

•  Users are Demanding more from Apps •  UI/UX Requirements are more sophisticated •  API Explosion •  Browser Enhancements •  The Web is No Longer Just About Documents but the

Existing Infrastructure Reflects this Legacy

•  HTML5 is the next Phase of the Web •  “HTML5” is a Programmatic Foundation for Apps •  Collection of Technologies

Page 6: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

6! Copyright © 2012 – Kaazing Corporation

HTML5 Feature Areas

Page 7: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

7! Copyright © 2012 – Kaazing Corporation

Connectivity Features

•  Cross Document Messaging •  XMLHttpRequest Level 2 •  Server-Sent Events •  WebSocket •  CORS

Page 8: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

8! Copyright © 2012 – Kaazing Corporation

New Technology

What is a WebSocket?

Page 9: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

9! Copyright © 2012 – Kaazing Corporation

Legacy Web Stack

•  Designed to serve static documents •  HTTP •  Half duplex communication

•  High latency •  Bandwidth intensive

•  HTTP header traffic approx. 800 to 2000 bytes overhead per request/response

•  Complex architecture •  Not changed since the 90’s •  Plug-ins •  Polling / long polling •  Legacy application servers

•  Expensive to scale applications Half duplex Full duplex

Page 10: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

10! Copyright © 2012 – Kaazing Corporation 4/20/12 10

Protocol mismatches… Inefficient…

Scalability Issues…

Latency Issues…

Middleware for the Middleware…

Page 11: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

11! Copyright © 2012 – Kaazing Corporation 4/20/12 11

Scalability

Growth

Complexity

Simple stuff scales… Complexity doesn’t

Greco’s Law!Scalability = Growth / Complexity

Page 12: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

12! Copyright © 2012 – Kaazing Corporation

•  Designed for document transfer •  Resource addressing •  Request / Response interaction •  Caching

•  Bidirectional, but half-duplex •  Traffic flows in only one direction at a time

•  Stateless •  Header (metadata) info resent for each request

HTTP Characteristics

Page 13: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

13! Copyright © 2012 – Kaazing Corporation

WebSocket

•  New W3C API and IETF Protocol for low-latency, real-time, bi-directional connections

•  RFC 6455 – Dec 2011 •  Easily add event-based data to web applications •  Avoids polling •  Avoids HTTP meta-data overhead

Page 14: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

14! Copyright © 2012 – Kaazing Corporation

WebSocket

•  Includes W3C API and IETF Protocol (RFC 6455) •  Event-driven JavaScript API •  Full-duplex communication protocol

•  Integrates HTTP addressing •  ws://yourcompany.com:80/tcp-for-the-web •  wss://anothercompany.com/marketdata_svc

•  Traverses firewalls, proxies, routers •  Leverages Cross-Origin Resource Sharing (CORS)

•  http://www.w3.org/TR/access-control/

•  Allows unlimited connections per Origin

Page 15: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

15! Copyright © 2012 – Kaazing Corporation

Living Web Stack

•  Designed for full-duplex high performance transactional Web •  HTTP & HTML5 WebSocket •  Full duplex communication

•  Lower latency •  Reduced bandwidth •  Simplified architecture •  Massive scalability

Half duplex Full duplex

Page 16: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

16! Copyright © 2012 – Kaazing Corporation

WebSocket Handshake

Page 17: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

17! Copyright © 2012 – Kaazing Corporation

WebSocket Frames

•  Frames have a few header bytes •  Data may be text or binary •  Frames from client to server are masked

(XORed w/ random value) to avoid confusing proxies

Page 18: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

18! Copyright © 2012 – Kaazing Corporation

Stuff we should know already

Oh yeah… JMS

Page 19: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

19! Copyright © 2012 – Kaazing Corporation

Java Messaging Service

•  Message Oriented Middleware •  Part of Java EE •  JMS 1.0 2001, JMS 1.1 2002, JMS 2.0 2013

(projected) •  Asynchronous Messaging vs RPC •  Loosely coupled vs Tightly coupled •  Pub/Sub, Topics, Queues •  Transactions, Reliable

Page 20: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

20! Copyright © 2012 – Kaazing Corporation

Basic JMS

conn = createConnection(); sess = conn.createSession(); topic = jndiContext.lookup(topic); pub = sess.createProducer(topic);

pub.send(“hey frank”);

conn = createConnection(); sess = conn.createSession(); topic = jndiContext.lookup(topic); sub = sess.createConsumer(topic); sub.setMessageListener(this); … public void onMessage(Message m) { String s = m.getText(); … do stuff… }

conn = createConnection(); sess = conn.createSession(); topic = jndiContext.lookup(topic); sub = sess.createConsumer(topic); sub.setMessageListener(this); … public void onMessage(Message m) { String s = m.getText(); … do stuff… }

conn = createConnection(); sess = conn.createSession(); topic = jndiContext.lookup(topic); sub = sess.createConsumer(topic); sub.setMessageListener(this); … public void onMessage(Message m) { String s = m.getText(); … do stuff… }

msg broker

Page 21: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

21! Copyright © 2012 – Kaazing Corporation

The Cool Part of Frank’s talk

Extending JMS over

the Web

Page 22: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

22! Copyright © 2012 – Kaazing Corporation 4/20/12 22

WebSocket

TCP

JMS XMPP AMQP B2B FTP VNC mktdata etc

Browser and Native Applications

WebSocket Server

Internet

WebSocket Server

Protocol Layering

Page 23: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

23! Copyright © 2012 – Kaazing Corporation

Back-end server

Browser

WebSocket

JMS Over WebSocket

Page 24: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

24! Copyright © 2012 – Kaazing Corporation

Back-end server

Browser

WebSocket

JMS Over WebSocket

JMS

Back-end server

Browser

WebSocket

Page 25: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

25! Copyright © 2012 – Kaazing Corporation

J2EE  Applica+on  Server  

Why JMS over WebSocket?

Message Broker (JMS Provider)

JMS Web Container

SOAP over HTTP Web

Service

JSP

Firewall

Typical Current JMS Architecture

HTTP

JMS Over WebSocket

Firewall

EJB Container

EJB

WEB

New WebSocket-based Architecture

Page 26: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

26! Copyright © 2012 – Kaazing Corporation

Server Support – JMS or WS

•  Kaazing WebSocket Gateway •  ActiveMQ •  Apache mod_pywebsocket •  Jetty •  phpwebsockets •  web-socket-ruby •  Yaws (Erlang) •  Node.js •  And more…

Page 27: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

27! Copyright © 2012 – Kaazing Corporation

Web Applications Now Change

Now we have reliable, secure real-time communications.

Not just broadcast (simple push), but bidirectional

communications for mobile and the desktop.

Examples: •  Financial Services •  Ecommerce, Retail •  Multi-player Gaming

•  Telecom •  Embedded Devices •  IPtv, cars, entertainment,

collaboration, et al…

Page 28: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

28! Copyright © 2012 – Kaazing Corporation

Copyright © 2010, Kaazing Corporation,. All rights reserved.

Kaazing Internals

WebSocket Gateway

•  async IO •  we don’t hold on to objects •  minimize latency •  minimal threading/GC •  staged event-driven arch •  JAAS, SSO, Kerberos, etc…

JMS ws

JMS

JMS

JMS

JMS

JMS

Page 29: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

29! Copyright © 2012 – Kaazing Corporation

Virtual Private Connection

Client and Server are now proxied over the web with no code changes

Page 30: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

30! Copyright © 2012 – Kaazing Corporation

Net

Msg Broker

Pricing Feeds

News/Alerts

Trade Exec

Reports

Mobile Browser/Native Client

Desktop Java/.NET

Browser Javascript/Flash/Java/Silverlight

Kaazing Gateway Cluster + Load Balancer

JMS, AMQP,

etc

Authentication Authorization

Other TCP/UDP protocols

Trading Services Architecture

Page 31: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

31! Copyright © 2012 – Kaazing Corporation

Possibilities…

•  Financial and trading apps •  Online gaming and live auctions •  BigData analytics •  Performance and monitoring dashboards •  RFID and GPS Tracking •  Sports and news broadcasting applications •  Supply chain and inventory management •  Transportation logistics •  Smart meters, embedded •  Next generation web application of your

choice!

Page 32: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

32! Copyright © 2012 – Kaazing Corporation

Financial Apps

http://demo.kaazing.com/portfolio

http://demo.kaazing.com/forex

Page 33: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

33! Copyright © 2012 – Kaazing Corporation

Gaming

http://code.google.com/p/quake2-gwt-port

Page 34: Extending JMS over the Web with HTML5 WebSocketfiles.meetup.com/1721111/NYJavaSIG-JMS-Over-WebSocket.pdf · 2012-04-24 · Why HTML5? • Users are Demanding more from Apps • UI/UX

34! Copyright © 2012 – Kaazing Corporation

Data Acquisition

http://bergmans.com/downloads.html

LabSocket Extend LabVIEW applications to the browser