そして物語は何度目かのアプリ内通知再実装を迎える / Reimplement in app notification

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
August 21, 2016

そして物語は何度目かのアプリ内通知再実装を迎える / Reimplement in app notification

京都なんか #2 の資料です

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

August 21, 2016
Tweet

Transcript

  1. ͦͯ͠෺ޠ͸Կ౓໨͔ͷ
 ΞϓϦ಺௨஌࠶࣮૷Λܴ͑Δ @moznion

  2. @moznion

  3. ΞϓϦ಺௨஌

  4. ྫ͑͹͜͏͍͏ͷ

  5. None
  6. ྫ͑͹͜͏͍͏ͷ

  7. ΞϓϦ಺௨஌Ͳ͏ͯ͠·͔͢ - ࠷ۙ͜͏΍ͬͯ·͢Αͱ͍͏࿩୊ - ࣮ࡍࠓ΋ͪΐͬͱ೰ΜͰ͍Δ
 ͱ͍͏εςʔλε

  8. ΞϓϦ಺௨஌ͷ๊͑Δ໰୊

  9. ΞϓϦ಺௨஌ͷ๊͑Δ໰୊ - ΞϓϦ಺௨஌͕ສೳͩͱ
 ࢥΘΕ͍ͯΔ

  10. ΞϓϦ಺௨஌ͷ๊͑Δ໰୊ - ΞϓϦ಺௨஌͕ສೳͩͱ
 ࢥΘΕ͍ͯΔ ສೳͰ͸ͳ͍

  11. ΞϓϦ಺௨஌ͷ๊͑Δ໰୊ - ༗ޮͳσʔλϞσϧΛߟ͑Δͷ͕೉͍͠ - τϨʔυΦϑ͕ੜ·Ε͕ͪ - writeʹڧ͘͢Δͷ͔ - readʹڧ͘͢Δͷ͔ -

    ͲͪΒ΋͔ (ͦΜͳͷ͋Δͷ͔) - ࣮ࡍͦͷลྑ͍Ϟσϧͬͯ͋ΔΜͰ͔͢ʁ
  12. σʔλϞσϧͷτϨʔυΦϑ - ྫ) ૉ๿ͳmailboxͷΑ͏ͳ࢓૊Έ - Read͕؆୯ - Subscriberʹඥͮ͘boxΛಡΊ͹ྑ͍ - Write͕ଟ͘ͳΔ

    - Subscriberʹൺྫ͢Δ
  13. σʔλϞσϧͷτϨʔυΦϑ - ྫ) ௨஌͕1rowͰsubscriber৘ใ͕ͿΒԼ͕Δ - Write͕؆୯ (গͳ͍) - 1௨஌1writeͰࡁΉ -

    Read͕೉͘͠ͳΔ - ಡΜͰ͘Δͱ͖ʹෳࡶͳΫΤϦ͕ཁΓ͕ͪ - JOIN஍ࠈ (΋͘͠͸ఱࠃ)
  14. ࢓༷͔Βߟ͑Δ

  15. ΞϓϦ಺௨஌ͷಛੑ (mailboxత࣮૷ͷ৔߹)

  16. ΞϓϦ಺௨஌ͷಛੑ (Ծఆ) - ଈ࣌ੑ͕ཉ͍͠ - ͕͋Δఔ౓ͷ஗Ԇ͸ڐ༰Ͱ͖Δ - (ڐ༰ग़དྷͳ͍৔߹΋͋Δ) - աڈʹḪͬͯϞϦϞϦݟΔɼΈ͍ͨͳػೳ͸

    ఏڙ͠ͳͯ͘ྑ͍ - ͋Δఔ౓Ͱ৘ใͷอ͕࣋ଧͪ੾ΓՄೳ
  17. ͋·Γؔ܎ͳ͍Ͱ͕͢ twitter App ͸ λΠϜϥΠϯͷ աڈϖʔδϯάΛ ఘΊ·ͨ͠Ͷ ͜ΕҎ্ಡΊͳ͍

  18. ԿΛҎͬͯͯ͠อ࣋Λଧͪ੾Δ͔ - ௨஌݅਺ - ࣌ؒܦա

  19. - ௨஌݅਺ - ࣌ؒܦա ͲͪΒͰ΋ྑ͍ͱࢥ͏ ԿΛҎͬͯͯ͠อ࣋Λଧͪ੾Δ͔

  20. - ௨஌݅਺Λج४ͱ͢Δ - ͋ΔϢʔβʹର͢Δσʔλ༰ྔ͕
 ߴʑN݅෼ʹݻఆͰ͖Δ - σʔλྔ͕༧ଌ͠΍͍͢ - ௨஌͕୹࣌ؒʹେྔʹૹΒΕΔͱ
 Ϣʔβଆ͕ݟΕͳ͘ͳΔͱ͍͏໰୊͸͋Δ

    ԿΛҎͬͯͯ͠อ࣋Λଧͪ੾Δ͔
  21. - ࣌ؒܦաΛج४ͱ͢Δ - ௨஌͕୹࣌ؒʹେྔʹૹΒΕͯ΋Ұఆ͕࣌ؒ ܦա͢Δ·Ͱ͸ഁغ͞Εͳ͍ͷͰಡΊΔ - ϢʔβʹΑΓσʔλͷ࠷େྔ͕ҟͳΔͷͰ
 ༧ଌ͠ʹ͍͘ - ͢͞·͍͡਺Λfollow͢ΔϢʔβͱ͔

    - ͍ΔΜͰ͢ΑͶ ԿΛҎͬͯͯ͠อ࣋Λଧͪ੾Δ͔
  22. - େྔʹ௨஌͕ཷ·͍ͬͯΔ࣌ɼ
 Ռͨͯ͠Ϣʔβ͸ಡΉͷ͔Ͳ͏͔ - ͍͍ͤͥNݸ͋Ε͹ྑ͍ΑͶɼ
 Έ͍ͨͳ৔߹͕ଟ͍ؾ͕͢Δ - ͱ͸͍͑͜ͷ΁Μ͸αʔϏεͷಛੑʹΑΔ - τϨʔυΦϑ

    ԿΛҎͬͯͯ͠อ࣋Λଧͪ੾Δ͔
  23. ࢓༷ϨϕϧͰ ͋Δఔ౓ݱ࣮తʹ͢Δ - ࢓༷Ͱ͋Δఔ౓ແཧͳػೳΛ஄͘ - ແݶʹϖʔδωʔγϣϯ͍ͨ͠ͱ͔ - ฒͼॱΛϢʔβ͝ͱʹࣗ༝ʹઃఆ͍ͨ͠ͱ͔ - ະདྷӬ߷ফ͑ͳ͍ͱ͔

    - (͔͠͠αʔϏεͷಛੑʹΑΔ) - ΞϓϦ಺௨஌͸ۜͷ஄ؙͰ͸ͳ͍
  24. ͦΕ͸ͦ͏ͱ

  25. ϢʔβA͕ϢʔβBΛfollowͨ࣌͠ʹɼ ϢʔβBͷաڈͷ௨஌ΛͲ͏͢΂͖͔

  26. Ͳ͏͢΂͖͔ - ݟํͷ໰୊ - ͦΕ͸ʮ௨஌ʯͳͷ͔ʁ - ͦΕ͸ʮλΠϜϥΠϯʯͳͷ͔ʁ

  27. Ͳ͏͢΂͖͔ - ʮ௨஌ʯͷ৔߹ - ೖΕΔඞཁͳ͠ - ௨஌͸ͦͷλΠϛϯά͋Γ͖Ͱ Ձ஋͕͋Δ৘ใ

  28. Ͳ͏͢΂͖͔ - ʮλΠϜϥΠϯʯͷ৔߹ - ೖΕΔඞཁ͋Δ - ͔͠͠ࠓճ͸ʮ௨஌ʯͷ࿩ - ͜Εݴ͍࢝ΊͨΒͳΜ͔צҧ͍Λ ͍ͯ͠ΔՄೳੑ͋Δ

  29. ݴͬͯΔ͜ͱ͸Θ͔Δ - ΞϓϦ಺ʹʮλϒʯͱͯ͠௨஌͕͋Δͱ
 λΠϜϥΠϯͩͱࢥͬͪΌ͏ - Θ͔ΔΘ͔Δ - ͔͠͠ҧ͏ (ҧ͏ͱ͍͏৔߹͕ଟ͍) -

    ͜͜Β΁Μࠞಉ͢Δͱෆ޾͕΍͖ͬͯ·͢
  30. ͸͍

  31. ࢓༷ײ͕͋Δఔ౓ڞ༗ Ͱ͖ͨͱ͜ΖͰ໰୊Λ ݟͯΈ·͠ΐ͏

  32. ΞϓϦ಺௨஌ͷ๊͑Δ໰୊ - ༗ޮͳσʔλϞσϧΛߟ͑Δͷ͕೉͍͠ - τϨʔυΦϑ͕ੜ·Ε͕ͪ - writeʹڧ͘͢Δͷ͔ - readʹڧ͘͢Δͷ͔ -

    ͲͪΒ΋͔ (ͦΜͳͷ͋Δͷ͔) - ࣮ࡍͦͷลྑ͍Ϟσϧͬͯ͋ΔΜͰ͔͢ʁ
  33. ͔͜͜Βઌ͸զʑ͕
 Ͳ͏΍͔ͬͨͱ͍͏࿩ʹͳΓ·͢

  34. എܠ

  35. എܠ - Java 8ͰΞϓϦέʔγϣϯΛॻ͍͍ͯΔ - ͍ΘΏΔmicroservicesΈ͍ͨͳߏ੒ - ࢖͑ΔετϨʔδͷछྨ͸ෳ਺͋Δ - MySQL

    - Redis - Elasticsearch - Memcached - ͦͦ͜͜Ϣʔβ਺͕͋Δ
  36. ํ਑ - MailboxͰ΍Ζ͏ - ௚ײతͰ͋Δ - σʔλྔͷ༧ଌ͕͋Δఔ౓ͭ͘ - ͱΓ͋͑ͣ௨஌ݸ਺ϕʔεͰ΍Δ

  37. Ͳ͏΍Δ͔ - ʮ໰୊ʯͰॻ͍ͨΑ͏ʹɼ
 RDBMS (SQL) Ͱ্ख͘΍Δํ๏Λ
 ฤΈग़ͤͳ͔ͬͨ - ࠓʹͳͬͯͬ͘͡Γߟ͑ͯΈΔͱ
 ग़དྷͨؾ͕͢Δ

    (γϟʔσΟϯάͱ͔)
  38. Ͳ͏΍Δ͔ - ͔͠͠༰ࣻͳ͘కΊ੾Γ͸͍ۙͮ ͯ͘Δ (਎ʹ͕֮͑͋ΔͰ͠ΐ͏) - Α͠ɼ͜͜͸ҰஸRedisͰ΍Ζ͏

  39. Redis

  40. Redis - આ໌ུ - LIST΍ΒZSET΍Βɼ
 ௨஌ʹ޲͍͍ͯͦ͏ͳσʔλߏ଄͕
 αϙʔτ͞Ε͍ͯͯศར

  41. Redis Cluster - Version 3͔Βఏڙ͞Ε͍ͯΔ ClusteringػೳΛར༻͍ͯ͠Δ - TODO: ͜͜ͰRedis ClusterΛ


    ๙Ίশ͑Δ
  42. Ͳͷσʔλߏ଄Λ
 ࠾༻͢Δ͔

  43. Ͳͷσʔλߏ଄Λ࠾༻͢Δ͔ - LIST - γϯϓϧ - LPUSH/RPOPΛ૊Έ߹ΘͤΔͱ
 ؆୯ʹQueueͷΑ͏ͳߏ଄Λ࣮ݱ Ͱ͖Δ

  44. Ͳͷσʔλߏ଄Λ࠾༻͢Δ͔ - ZSET - ιʔτࡁΈηοτ - Α͘ϥϯΩϯάͷ࣮૷ͱ͔ʹ࢖ΘΕΔ΍ͭ - TimestampΛscoreʹͯ͠ɼͦΕΛ ZREVRANGE

    ͱ͔ͰҾ͍ͯ͘Δͱ࠷৽ॱͰऔͬͯ͜ΕΔ - ॱҐ΍είΞϕʔεͰ੾Γ٧Ί΋Ͱ͖ΔͷͰศར
  45. ͲΕʹͨ͠ͷ͔

  46. Ͳͷσʔλߏ଄Λ࠾༻͢Δ͔ ZSETʹͨ͠

  47. ZSETʹͨ͠ - Timestamp ͷ߱ॱͰදࣔ͞ΕΔͷͰɼ ΋͠΋Կ͔͋ͬͨ࣌ʹλΠϜελϯϓ Λج४ͱͯ͠௨஌ίϯςϯπͷௐ੔
 ͕ޮ͘

  48. ZSETʹͨ͠ - ͨͱ͑͹ʢࢄʑ൱ఆͯͨ͠Μ͚ͩͲʣ ৗʹઌ಄ʹද͍ࣔͨ͠ɼΈ͍ͨͳͷ͕ དྷͨ࣌ʹ΋ରԠ͕ग़དྷΔ
 (ແݶʹେ͖͍஋Λ score ʹͯ͠΍Δͱ ࣮ݱ͕Ͱ͖Δ)

  49. ZSETʹͨ͠ - ͨͱ͑͹ʢࢄʑ൱ఆͯͨ͠Μ͚ͩͲʣ ৗʹઌ಄ʹද͍ࣔͨ͠ɼΈ͍ͨͳͷ͕ དྷͨ࣌ʹ΋ରԠ͕ग़དྷΔ
 (ແݶʹେ͖͍஋Λ score ʹͯ͠΍Δͱ ࣮ݱ͕Ͱ͖Δ) ੈͷதԿ͕ى͜Δ͔Θ͔Βͳ͍

  50. ZSETʹͨ͠ - ݸ਺ϕʔεͷmailboxʹ΋ɼ
 ࣌ؒܦաϕʔεͷmailboxʹ΋
 ରԠͰ͖Δ

  51. ZSETʹͨ͠ - ݸ਺ϕʔεͷmailboxʹ΋ɼ
 ࣌ؒܦաϕʔεͷmailboxʹ΋
 ରԠͰ͖Δ ੈͷதԿ͕ى͜Δ͔Θ͔Βͳ͍

  52. ZSETʹͨ͠ - ෭࡞༻͚ͩΕͲ - จݴ͕ಉ͔ͭ͡timestamp͕ҧ͏ͱ͍͏ΞΠςϜ ͕དྷͨ৔߹ɼ৽͘͠དྷͨ΋ͷ͕༏ઌ͞ΕΔ
 => μϒΓ͕ͳ͘ͳΔ - ͜Ε͕ศརͳ৔߹ͱศརͰ͸ͳ͍৔߹͕


    ͋Γͦ͏͕ͩࠓճ͸ศརͩͬͨ
  53. ະಡ؅ཧͲ͏͢Δ͔

  54. ະಡ؅ཧͲ͏͢Δ͔ - ଟ͘ͷΞϓϦ಺௨஌Ͱ͸
 ະಡ؅ཧͷ࣮૷͕ཁٻ͞ΕΔ - Կ݅ཷ·ͬͯΔ͔ɼͱ͔ - ͲΕ͕৽ணͷ௨஌͔ɼͱ͔

  55. ະಡ؅ཧ - MailboxͱରԠ͢ΔΧ΢ϯλͷΤ ϯτϦΛredis಺ʹ࣋ͭΑ͏ʹͨ͠ - ৽͍͠௨஌͕དྷͨࡍʹZSETʹ
 ௥Ճ͢Δͱಉ࣌ʹΧ΢ϯλΛINCR

  56. Add notification notification|{subscriberId} - Notification unreadCount|{subscriberId} - Unread count

  57. Add notification notification|{subscriberId} - Notification unreadCount|{subscriberId} - Unread count ZADD

  58. Add notification notification|{subscriberId} - Notification unreadCount|{subscriberId} - Unread count INCR

  59. Add notification notification|{subscriberId} - Notification unreadCount|{subscriberId} - Unread count INCR

    ZADD ಉ࣌ʹߦ͏ (ޙड़)
  60. ະಡ؅ཧ - ΫϥΠΞϯτ͔ΒϦΫΤετ͕͋ͬͨ࣌ ʹ௨஌ͱҰॹʹΧ΢ϯτΛฦͯ͠΍Δ - ΫϥΠΞϯτ͸ͦͷΧ΢ϯτΛ࢖ͬͯ ʮ͜Ε͕৽ணʯͱ͍͏ݟͤํ͕Ͱ͖Δ - ͦͷ࣌ʹΧ΢ϯλ͸ΫϦΞͯ͠΍Δ

  61. Client Get notification

  62. Client Get notification Return notification and unread count

  63. Client Get notification Return notification and unread count SET unreadCount|{subscriberId}

    0 ͱಉ࣌ʹ
  64. ະಡ؅ཧ - ৭ʑ࢖͍Ͱ͕͋ΔͷͰະಡΧ΢ϯ τ͚ͩΛฦ͢API΋ఏڙ͍ͯ͠Δ - શମతʹγϯϓϧ

  65. AtomicʹredisΛ
 ૢ࡞͢Δ

  66. AtomicʹredisΛૢ࡞͢Δ - 1subscriber͋ͨΓͷ௨஌Λ࣮ݱ ͢Δʹ͋ͨͬͯredis಺ʹ2Τϯτ Ϧඞཁͱͳͬͨ - Atomicʹૢ࡞͢Δඞཁ͕ग़ͯ͘Δ

  67. Add notification notification|{subscriberId} - Notification unreadCount|{subscriberId} - Unread count INCR

    ZADD ಉ࣌ʹߦ͏
  68. AtomicʹredisΛૢ࡞͢Δ - Redis TransactionΛ࢖͏ - MULTI-EXECΛ࢖͏ํ๏ - ͋·ΓΦεεϝͰ͖ͳ͍ - Redis

    Scriptingͷํ͕ߴ଎ - ͍ͣΕػೳ͔Βআڈ͢Δ͔΋ͬͯݴͬͯΔ
  69. AtomicʹredisΛૢ࡞͢Δ - Redis ScriptingΛ࢖͏ - LuaʹΑΔscriptingΛ࢖͏ํ๏ - Redis TransactionΑΓߴ଎ -

    1Script಺ͷૢ࡞͸atomicʹߦΘΕΔ - ཁ͸ྑ͍ετΞυΈ͍ͨͳ΍ͭͰ͢
  70. Redis Scripting - EVALίϚϯυ͸LuaεΫϦϓτΛ
 ຖճredis serverʹૹ৴͢Δ - EVALίϚϯυͰLuaεΫϦϓτΛ࣮ߦ ͢ΔͱͦͷεΫϦϓτ͕SHA1ͷKeyʹ ͳͬͯredis

    server಺ʹ֨ೲ͞ΕΔ
  71. Redis Scripting - Ұ౓SHA1͕ొ࿥͞Εͯ͠·͑͹ɼ
 Ҏ߱͸ͦͷSHA1ΛEVALSHAίϚϯυ Ͱ౉͢Α͏ʹ͢Δͱಈ࡞͢Δ - ଳҬΛઅ໿Ͱ͖Δʂ

  72. EVAL foo

  73. EVAL foo Register sha1(foo) {sha1(foo) => foo}

  74. EVAL foo Register sha1(foo) Execute foo {sha1(foo) => foo}

  75. EVAL foo Register sha1(foo) Execute foo (Result of foo) {sha1(foo)

    => foo}
  76. Remembering sha1(foo) {sha1(foo) => foo}

  77. EVALSHA sha1(foo) Remembering sha1(foo) {sha1(foo) => foo}

  78. EVALSHA sha1(foo) Remembering sha1(foo) {sha1(foo) => foo} Execute foo

  79. EVALSHA sha1(foo) Remembering sha1(foo) {sha1(foo) => foo} Execute foo (Result

    of foo)
  80. Redis Scripting - ͍͍ͪͪͦ͏͍͏ॲཧΛॻ͘ͷ΋໘౗ ͍͘͞ͷͰwrapperΛॻ͍ͨ - https://github.com/moznion/redis- script-manager-core - த਎͸@shogo82148͞Μͷ


    p5-Redis-ScriptͷҠ২
  81. Redis Scripting - ϒϩάʹॻ͍͓͍ͯͨ - http://moznion.hatenadiary.com/entry/ 2016/05/10/214648

  82. શମ૾ͱͯ͠
 Ͳ͏ͳ͍ͬͯΔͷ͔

  83. Redis (JobQueue) Redis Cluster Worker Business Domain

  84. ؆୯ͳྲྀΕ (഑ૹฤ) 1. ϏδωευϝΠϯ͕JobQueueʹ௨஌ͷ ͨΊͷpayloadΛͭΊΔ 2. Worker͕payloadΛऔͬͯ͘Δ 3. Worker͕ରԠ͢Δsubscriberʹ௨஌Λඈ ͹͢

  85. i. Enqueue a job to deliver notification ii. Pickup a

    job iii. Deliver notification Redis (JobQueue) Redis Cluster Worker Business Domain
  86. ؆୯ͳྲྀΕ (഑ૹฤ) 1. ϏδωευϝΠϯ͕JobQueueʹ௨஌ͷ ͨΊͷpayloadΛͭΊΔ 2. Worker͕payloadΛऔͬͯ͘Δ 3. Worker͕ରԠ͢Δsubscriberʹ௨஌Λඈ ͹͢

  87. i. Enqueue a job to deliver notification ii. Pickup a

    job iii. Deliver notification Redis (JobQueue) Redis Cluster Worker Business Domain
  88. JobQueueʹPayloadΛͭΊΔ - NotificationDeliverer Interface - deliver(String json) ͱ͍͏
 ந৅methodΛ࣋ͬͨInterface

  89. JobQueueʹPayloadΛͭΊΔ - NotificationDeliverer#deliver(String json) - ୭ʹૹΔ͔ (Ͳͷredis entryʹ഑ૹ͢Δ͔) - Push௨஌͕ඞཁ͔Ͳ͏͔

    - Λҙ࣮ࣝͭͭ͠૷͢Δ
  90. JobQueueʹPayloadΛͭΊΔ - ೚ҙͷNotificationDelivererͷ࣮૷ͷclass name
 (ForAllUserDeliverer.classΈ͍ͨͳ) - Delivererͷ࣮૷΁ͷarguments - MessageΛද͢JSON String

    (ޙड़) - ΛPayloadͱͯ͠JobQueueʹͭΊΔ
  91. ؆୯ͳྲྀΕ (഑ૹฤ) 1. ϏδωευϝΠϯ͕JobQueueʹ௨஌ͷ ͨΊͷpayloadΛͭΊΔ 2. Worker͕payloadΛऔͬͯ͘Δ 3. Worker͕ରԠ͢Δsubscriberʹ௨஌Λඈ ͹͢

  92. i. Enqueue a job to deliver notification ii. Pickup a

    job iii. Deliver notification Redis (JobQueue) Redis Cluster Worker Business Domain
  93. Worker͕payloadΛऔͬͯ͘Δ - ରԠ͢ΔWorker͕JobQueue͔Β payloadΛऔͬͯ͘Δ - Ҏ্

  94. ؆୯ͳྲྀΕ (഑ૹฤ) 1. ϏδωευϝΠϯ͕JobQueueʹ௨஌ͷ ͨΊͷpayloadΛͭΊΔ 2. Worker͕payloadΛऔͬͯ͘Δ 3. Worker͕ରԠ͢Δsubscriberʹ௨஌Λඈ ͹͢

  95. i. Enqueue a job to deliver notification ii. Pickup a

    job iii. Deliver notification Redis (JobQueue) Redis Cluster Worker Business Domain
  96. ௨஌Λඈ͹͢ - Worker͸औ͖ͬͯͨpayload͔Β ʮNotificationDelivererͷ࣮૷ͷ class nameʯΛऔΓग़͠ɼ reflectionΛ࢖ͬͯinstantiate͢Δ

  97. JobQueueʹPayloadΛͭΊΔ - ೚ҙͷNotificationDelivererͷ࣮૷ͷclass name
 (ForAllUserDeliverer.classΈ͍ͨͳ) - Delivererͷ࣮૷΁ͷarguments - MessageΛද͢JSON String

    (ޙड़) - ΛPayloadͱͯ͠JobQueueʹͭΊΔ
  98. ௨஌Λඈ͹͢ - ͦͷΠϯελϯεͷ
 deliver(String json)Λpayload಺ʹ
 ؚ·Ε͍ͯͨJSONΛ࢖ͬͯݺͼग़͢ - ࣮૷ʹج͍ͯ௨஌͕ඈͿ

  99. JobQueueʹPayloadΛͭΊΔ - ೚ҙͷNotificationDelivererͷ࣮૷ͷclass name
 (ForAllUserDeliverer.classΈ͍ͨͳ) - Delivererͷ࣮૷΁ͷarguments - MessageΛද͢JSON String

    (ޙड़) - ΛPayloadͱͯ͠JobQueueʹͭΊΔ
  100. ௨஌Λඈ͹͢ - ௨஌͕ඈͿͱݴͬͯ΋࣮ࡍʹ͸subscriberͷ mailbox (ZSET) ʹ௥Ճ͞ΕΔ͚ͩ - Score͸λΠϜελϯϓ - Valueʹ͸deliver()

    ʹ౉͖ͬͯͨJSON͕ͦͷ·· ೖΔ - ͦͷ࣌௨஌ݸ਺͕ଟ͚Ε͹ݹ͍΋ͷΛ௥͍ग़͢
  101. ValueͷJSONʹ͸Կ͕
 ೖ͍ͬͯΔͷ͔

  102. JSONʹ͸Կ͕ʁ - NotificationMessageFactoryΛ࣮ ૷ͨ͠classͷclass name - ϓϨʔεϗϧμ಺ʹೖΔΞΠς ϜͷJSON

  103. JSONʹ͸Կ͕ʁ - NotificationMessageFactory - String makeNotificationMessage(
 T bind,
 Language lang


    ) - ͱ͍͏ந৅methodΛ࣋ͭInterface
  104. JSONʹ͸Կ͕ʁ - makeNotificationMessage() - ௨஌ϝοηʔδΛ૊ΈཱͯΔ - Payload͔Βऔ͖ͬͯͨJSONΛ σγϦΞϥΠζͨ͠΋ͷΛ࢖͏ - ଟݴޠԽ΋͜͜Ͱٵऩ

  105. JSONʹ͸Կ͕ʁ - αʔόαΠυͰ௨஌จݴΛ૊ΈཱͯΔ ͱ͍͏લఏ (ޙड़) - ੜϝοηʔδ͕ೖͬͯΔͱi18n͕΍Γ ʹ͍͘ - ͷͰ͜͏͍͏ߏ੒ʹ

  106. ؆୯ͳྲྀΕ (औಘฤ) 1. ௨஌ΛҾ͍ͯ͘Δ 2. Ҿ͍͖ͨͨ௨஌શ෦ʹରͯ͠
 ϝοηʔδΛ૊ΈཱͯΔ

  107. o. Get Redis (JobQueue) Redis Cluster Worker Business Domain i.

    Retrieve notification ii. Construct notification messages iii. Return
  108. ؆୯ͳྲྀΕ (औಘฤ) 1. ௨஌ΛҾ͍ͯ͘Δ 2. Ҿ͍͖ͨͨ௨஌શ෦ʹରͯ͠
 ϝοηʔδΛ૊ΈཱͯΔ

  109. o. Get Redis (JobQueue) Redis Cluster Worker Business Domain i.

    Retrieve notification ii. Construct notification messages iii. Return
  110. ௨஌ΛҾ͍ͯ͘Δ - ର৅ͱͳΔsubscriberͷmailbox (ZSET) ͔Β௨஌ΛҾ͍ͯ͘Δ - ZREVRANGEίϚϯυ

  111. ؆୯ͳྲྀΕ (औಘฤ) 1. ௨஌ΛҾ͍ͯ͘Δ 2. Ҿ͍͖ͨͨ௨஌શ෦ʹରͯ͠
 ϝοηʔδΛ૊ΈཱͯΔ

  112. o. Get Redis (JobQueue) Redis Cluster Worker Business Domain i.

    Retrieve notification ii. Construct notification messages iii. Return
  113. ϝοηʔδΛ૊ΈཱͯΔ - Ҿ͍͖ͯͨ௨஌͸JSON String - ͔͜͜Βਓ͕ಡΊΔϝοηʔδΛ ૊ΈཱͯΔඞཁ͕͋Δ

  114. JSONʹ͸Կ͕ʁ - NotificationMessageFactoryΛ
 ࣮૷ͨ͠classͷclass name - ϓϨʔεϗϧμ಺ʹೖΔΞΠς ϜͷJSON

  115. ϝοηʔδΛ૊ΈཱͯΔ - NotificationMessageFactoryΛ࣮૷ͨ͠classͷ class nameΛ࢖ͬͯreflectionͰinstantiate - makeNotificationMessage() ݺͿ - ΞΠςϜͷJSONΛ࢖ͬͯϓϨʔεϗϧμΛຒΊΔ

    - ୺຤ͷݴޠ৘ใʹج͖ͮ࠷దͳݴޠͰ૊ΈཱͯΔ
  116. LLͷྑ͍ͱ͜ΖΛ
 आΓ͖࣮ͯͨ૷ͱ͍͏ײ͡

  117. - ͱ͸͍࣮͑ߦ࣌ྫ֎͕όϯόϯ ى͖Δͷ͸ࠔΔͷͰɼ
 δΣωϦΫεͰറ͍ͬͯΔײ͡ - ΠϯϓοτͷνΣοΫΛݫ֨ʹ

  118. ͔͠͠ReflectionͰinstantiate
 ͢Δͱίετߴͦ͏ͩ͠ɼ
 ͔͠΋ຖ౓ຖ౓΍Δͷμα͘ͳ͍ʁ

  119. FlyWeight - FlyWeightͰ΍Ε͹҆৺ - Ϋϥεࣗମ͸ΠϛϡʔλϒϧͳͷͰ ࢖͍ճ͕͠ޮ͘ - ·͍ͨͭͰʹ sprint ͱ͍͏΋ͷ΋


    ॻ͍ͨ
 https://github.com/moznion/sprint
  120. ͱ͍͏ײ͡ ࣮ࡍʹͪΌΜͱಈ͍ͯΔʂ ΊͰͨ͠ΊͰͨ͠

  121. ͱ͸ͳΒͳ͍

  122. ໰୊ - Ͳ͏ͯ͠΋Redisʹෛՙ͕ूத͠ ͯ͠·͏…… - ௨஌഑৴࣌ͷτϥϑΟοΫͷ޲্ - σʔλαΠζͷ্ঢ

  123. Ͳ͏͢΂͖͔

  124. Ͳ͏͢΂͖͔ - RedisΛγϟʔσΟϯάͯ͠࢖͏ ͱ͔……ʁ

  125. ະ׬