Iteratee and stream with Play2 scala
Upcoming SlideShare
Loading in...5
×
 

Iteratee and stream with Play2 scala

on

  • 1,635 views

slides of my talk for tokyo scala user group

slides of my talk for tokyo scala user group

Statistics

Views

Total Views
1,635
Views on SlideShare
1,635
Embed Views
0

Actions

Likes
4
Downloads
21
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Iteratee and stream with Play2 scala Iteratee and stream with Play2 scala Presentation Transcript

  • MANAGE STREAMS WITH ITERATEE AND PLAY FRAMEWORK BY @WAXZCE TOKYO SCALA USER GROUP
  • WHO AM I ? CEO of Clever Cloud PaaS provider @waxzce on twitter www.clever-cloud.com
  • WHY WE NEED ITERATEE ? SO,
  • ITERATEE HANDLING STREAMS, LET’S FIND EXAMPLE IN FACTS
  • WHAT IS INSIDE AN HTTP REQUEST ? Verb • The action Resource • The object of the action Headers • The context of the action Body • Optional • The datas
  • IN MANY CASE THE REQUEST IS MANIPULATE ALL FROM MEMORY
  • File upload for example BUT SOMETIMES THE BODY PART IS FAT
  • THERE IS 3 WAY TO RESOLVE THE PROBLEM
  • PUT ALL IN MEMORY
  • CREATE TEMP FILE Built in on play with
  • ACTING DIRECTLY ON STREAM
  • HTTP REQUEST IS STREAM
  • SO WE WILL JUST MANAGE THE BODY STREAM JUST DO NOT REWRITE HTTP PARSER
  • CLASSIC JAVA STREAM MANAGEMENT
  • CLASSIC JAVA STREAM MANAGEMENT • Low performances if not buffered • Not modular • Thread blocking • Code is ugly
  • SCALA WAY : ITERATEE
  • Like a recipe Consume the data ITERATEE : HOW TO MANAGE A STREAM
  • Produce the data ENUMERATOR : DATA STREAM
  • Set of tools to do cool things with Iteratee and Enumerator ENUMERATEE
  • SIMPLE ITERATEE EXAMPLE
  • BODY PARSERS REQUEST HEADERS -> ITERATEE[ARRAY[BYTE], EITHER[RESULT, ?]]
  • EXAMPLE MANAGING BODY
  • GET FILE AND CALCULATE HASH FROM CHUNK
  • NOW LIVE CODE !
  • GIFT FROM CLEVER CLOUD Use tokyoscala as coupon code for free hosting  On clever-cloud.com