2. About Me
• Developer Advocate for Cloud Foundry
• Blog: http://videlalvaro.github.com/
• Twitter: @old_sound
Monday, February 25, 13
3. About Me
• Developer Advocate for Cloud Foundry
• Blog: http://videlalvaro.github.com/
• Twitter: @old_sound
• I created gifsockets™
Monday, February 25, 13
4. About Me
Co-authored
RabbitMQ in Action
http://bit.ly/rabbitmq
Monday, February 25, 13
5. Why do you
need messaging?
Monday, February 25, 13
31. Let’s see the
code evolution
Monday, February 25, 13
32. Pseudo Code
Comments
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
33. Pseudo Code
Function Name
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
34. Pseudo Code
Arguments
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
35. Pseudo Code
Function Body
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
36. Pseudo Code
Return Value
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
37. First Implementation:
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Monday, February 25, 13
38. Second Implementation:
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
resize_image(Image),
ok.
Monday, February 25, 13
39. Third Implementation:
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
resize_image(Image),
notify_friends(ReqData:get_user()),
ok.
Monday, February 25, 13
44. What if
• We need to speed up image conversion
Monday, February 25, 13
45. What if
• We need to speed up image conversion
• User notifications sent by email
Monday, February 25, 13
46. What if
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
Monday, February 25, 13
47. What if
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
• Resize in different formats
Monday, February 25, 13
48. What if
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
• Resize in different formats
• Swap Language / Technology (No Down
Time)
Monday, February 25, 13