stomp 1.2 getting the message across: rebooted. brief introduction julian lyndon-smith, it director...

Post on 26-Dec-2015

218 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

STOMP 1.2GETTING THE MESSAGE ACROSS:

REBOOTED

BRIEF INTRODUCTION

• Julian Lyndon-Smith, IT Director dot.r limited• Progress developer since v3, 1987• Living proof of “old dog, new tricks”

• Often hanging around on PEG and PSDN• Always up for a good argument ;)

WHY MESSAGING ?

• In-application• Inter process• Lan• Wan• Internet

WHAT’S WRONG WITH …

• Pub / sub• Sonic• IP/Works• Zero MQ• MO/SMS

WHAT’S NEEDED

• Message server• Clients connect to server, like 4GL clients to db server

• Free / open source• Portable• Easy to set up and admin• Usable from the 4GL

WHAT’S AVAILABLE

• Apache Apollo• HornetMQ• RabbitMQ• MorbidMQ• Apache ActiveMQ

WE CHOSE …

• Apache ActiveMQ• http://activemq.apache.org• Fusesource used to be a division of Psc• Fits all the criteria• Queues• Topics• wildcards

WHAT PROTOCOL ?

• Openwire• REST• Stomp• XMPP• AMQP

ENTER STOMP

“STOMP provides an interoperable wire format so that STOMP clients can communicate with any STOMP message broker to provide easy and widespread messaging interoperability among many languages, platforms and brokers.”

ENTER STOMP

• Simple Text-Orientated Messaging Protocol• Stomp.github.com

• Text-based• Therefore easy to use in the 4GL

• Multiple clients• Java, .net, javascript, php, ruby …

STOMP PROTOCOL

• Each message is sent within a “Frame”COMMANDHeader1:valueHeader2:value

Body^@

STOMP PROTOCOL

• Frame starts with command string<EOL>• Followed by zero or more headers

• Each header consists of <key>:<value><EOL>• Blank line indicates end of headers

• The body is terminated with a null ( chr(0) )

STOMP PROTOCOL

• All commands and headers are in UTF-8• As mentioned, the body is terminated with chr(0)• Unless you have a content-length:n header• Which then means the body is read for n octets• Regardless of embedded nulls

CONNECTING

• Client initiates connection by sending a CONNECT frame

CONNECT

accept-version:1.2

host:stomp.github.org

^@

CONNECTED

• Server responds with a CONNECTED frameCONNECTED

version:1.2

^@

SENDING MESSAGES

• Client sends messages by sending a SEND frame to a destination• Queue• Topic

SENDING MESSAGES

SEND

destination:/queue/a

content-type:text/plain

hello queue a

^@

SENDING MESSAGES

SEND

destination:/topic/b

content-type:text/plain

hello topic b

^@

RECEIVING MESSAGES

• Client receives messages by sending a SUBSCRIBE frame• Queue• Topic• Wildcards

RECEIVING MESSAGES

• Client receives messages by sending a SUBSCRIBE frame• Waits for a message to arrive on the socket• Data is parsed by the 4GL

RECEIVING MESSAGES

SUBSCRIBE

id:0

destination:/queue/foo

^@

RECEIVING MESSAGES

• Server sends messages to subscribed clients by sending a MESSAGE frame

MESSAGE

subscription:0

message-id:007

destination:/queue/a

content-type:text/plain

hello queue a^@

WELL, THAT SEEMS SIMPLE ENOUGH

WALK BEFORE YOU RUN …

• ABL Socket issues• Read-response procedure

• ABL Issues• Memory leaks

• Performance issues

SUCCESS !

• All 4GL issues solved • By better coding • Fixed sockets by :enabled• Fixed memory leaks by better use of events

PLATFORMS

• 4GL Clients • Win32, webspeed, character• NOT Appserver• Linux supported (as tested by Tom Bascom)

• Many other clients

WHAT CAN WE DO WITH THIS ?

• 4GL – 4GL communication• Internal, local, network, internet

• Node.js 4GL• Web browsers 4GL• Rest / curl / php / ruby / js 4GL …

HOW MUCH IS THIS GOING TO COST ?

• Nothing. Nada. • Server is free (ActiveMQ)• http://activemq.apache.org/

• 4GL Stomp adapter is free• https://bitbucket.org/jmls/stomp/overview• MIT licence. Free to use in commercial products

DEMOS, QUESTIONS,DEBATE

top related