ããã¤ã¯ããµã¼ãã¹ã¨ã¡ãã»ã¼ã¸ã³ã°ã®ãªã [æ¦è¦ç·¨]ãã¯ãã¡ãã§ãã
ã¬ãããããã§ã¤ã³ãã°ã¬ã¼ã·ã§ã³ã®ããã®ããã«ã¦ã§ã¢è£½åã®ãã¯ãã«ã«ãµãã¼ããæ å½ãã¦ããå±±ä¸ã§ãã æ¦è¦ç·¨ã§ã¯ã¡ãã»ã¼ã¸ã³ã°ã®è¯ãé¢ã°ããã«ç¦ç¹ãå½ã¦ã¦ãã¾ããããä»åã®çåç·¨ã§ã¯ã¡ãã»ã¼ã¸ã³ã°ãæ¤è¨ãå§ããã¨ãã«çåã«æã£ããå°ããã¡ãªãã¨ã説æãããã¨æãã¾ããæ¦è¦ç·¨ã¨ã¯ç°ãªããç´°ããªæè¡çå 容ãå«ã¾ãã¾ãã®ã§ããã®æã ã§å¿ è¦ãªé¨åãèå³ããé¨åã ãèªãã§ããã ããã°ã¨æãã¾ãã
(ã¨ããã§ãå½åã¯ååãåç·¨ãããã¦ä»åãå¾ç·¨ã«ãã¦çµãããããã¨æã£ã¦ããã®ã§ãããä»åããã¾ãã«é·ããªã£ã¦ãã¾ã£ãã®ã§ãæ§æãå¤ããã®ã§ããã ãã®ããå½åã®åç·¨ã¯æ¦è¦ç·¨ã¨ååãå¤æ´ãã¦ãã¾ãã)
ã§ã¯ã¾ã主ã«çåã¨ããããã¨ã確èªãã¦ããã®å¾ã«å¯¾å¦æ³ãè¦ã¦ããã¾ãããã
- ã¡ãã»ã¼ã¸ã³ã°ãå©ç¨ãããã¨ã«ãã主ãªçå
- 対å¦æ¹æ³
- Q1: ã¡ãã»ã¼ã¸ã¯éè¤é ä¿¡ããããã¨ããã
- Q2: ã©ã®ããã«ãµã¼ãã¹å ã®ãã¼ã¿ãã¼ã¹æ´æ°ã¨ã¡ãã»ã¼ã¸çºè¡ãã¢ãããã¯ã«å®ç¾ããã®ãï¼
- Q3: ãµã¼ãã¹ãçºè¡ããã³ãã³ãã«å¯¾ããå¿çãåãåãæ¹æ³
- Q4: ã¦ã¼ã¶ãã³ãã³ãã®å®è¡ç¶æ³ãææ¡ããæ¹æ³
- Q5: æ¶ããªãã¤ãã³ãã¨ã¤ãã³ãã®ãã¼ã¸ã§ãã³ã°
- ã¾ã¨ã
ã¡ãã»ã¼ã¸ã³ã°ãå©ç¨ãããã¨ã«ãã主ãªçå
Q1: ã¡ãã»ã¼ã¸ã¯éè¤é
ä¿¡ããããã¨ããã
ãã¤ã¯ããµã¼ãã¹ã§ã¯ãã·ã¹ãã ãæ§æããå種ãã¼ãããããã¯ã¼ã¯ã§é害ãçºçãããã¨ãåæã¨ãã¦åãå
¥ãã¾ããä¸æ¹ã§ãããããã®ãµã¼ãã¹ã¯åå¥ã«ãã¼ã¿ãã¼ã¹ãæã¡ãæ©è½ä¸ã®å¶ç´ãããã©ã¼ãã³ã¹ç¹æ§ãããã¦èé害æ§ãªã©ã®çç±ããXAã®ãããªåæ£ãã©ã³ã¶ã¯ã·ã§ã³ãå©ç¨ãã¾ããããã®ããã¡ãã»ã¼ã¸ã失ãããªãããã«ããã«ã¯ããµã¼ãã¹ãã¡ãã»ã¼ã¸ã³ã°ããã¼ã«ã¼éã®æ§ã
ãªã¬ã¤ã¤ã¼ã«ã¦éä¿¡ãæåãããã¨ã確å®ã«å¤æã§ããã¾ã§ãªãã©ã¤ãè¡ããã¾ãããããä¸æ¹ã§ããã¯ã¡ãã»ã¼ã¸ã®éè¤é
ä¿¡ãè¡ãããåå ã¨ããªãã¾ãã
Q2: ã©ã®ããã«ãµã¼ãã¹å
ã®ãã¼ã¿ãã¼ã¹æ´æ°ã¨ã¡ãã»ã¼ã¸çºè¡ãã¢ãããã¯ã«å®ç¾ããã®ãï¼
ãµã¼ãã¹ã¯ã³ãã³ããåããã¨ããã¼ã¿ãã¼ã¹ãæ´æ°ãã¦åæã«ã¤ãã³ããçºè¡ãããã¨ãä¸è¬çã§ãããããããã¼ã¿ãã¼ã¹ã¨ã¡ãã»ã¼ã¸ã³ã°ããã¼ã«ã¼ã¯ãåè¿°ã®ããã«åæ£ãã©ã³ã¶ã¯ã·ã§ã³ã¯å©ç¨ãã¾ããããã®ãããã¼ã¿ãã¼ã¹ã®ã³ãããã«ã¯æåãããã®ã®ãã¡ãã»ã¼ã¸éä¿¡ã«ã¯å¤±æããã¨ãããã¨ãããå¾ã¾ããKafkaã¯ã·ã¹ãã ããããã¼ã¿ããã¨ãã¦ã®å½¹å²ãæ
ã£ã¦ãããããåãå
¥ããããªããã¼ã¿ä¸æ´åã®åå ã¨ãªãã¾ãã
Q3: ãµã¼ãã¹ãçºè¡ããã³ãã³ãã«å¯¾ããå¿çãåãåãæ¹æ³
RESTãªã©ã®åæéä¿¡ã§ã¯ãã®å¿ççµæãåãåããã¨ãå¯è½ã§ããããããã¡ãã»ã¼ã¸ã³ã°ã§ã¯ãFire and Forgetã¨ãè¨ãããããã«ãã¡ãã»ã¼ã¸ã¯æãã£ã±ãªãã¨ããããã«ããµã¼ãã¹ã¯ãã®å¿çãååããã¨ã¯ã§ãã¾ããããããããã¸ãã¹ä¸ã®ã¢ã¯ã·ã§ã³ãå¿çãæå¾
ãã¦ã³ãã³ããéä¿¡ããã±ã¼ã¹ãããã¾ããã¡ãã»ã¼ã¸ã³ã°ã§ã¯ã©ã®ããã«å¿çãåãåã£ããããã®ã§ããããï¼
Q4: ã¦ã¼ã¶ãã³ãã³ãã®å®è¡ç¶æ³ãææ¡ããæ¹æ³
å¤ãã®ã¢ããªã·ãã¯ãªã·ã¹ãã ã§ã¯ã³ãã³ãã¯åæå¦çãããå¿çãè¿ã£ã¦ããã°å¦çã¯å®äºãã¦ãããå®äºç»é¢ã«å¦ççµæã表示ããããã¨ãã§ãã¾ããããããã¡ãã»ã¼ã¸ã³ã°ã§ã®ã³ãã³ãã¯ããã¥ã¼ï¼ãããã¯ï¼ã«å
¥ãããã¤ã³ãã³ããå¦çãããã®ãããããã¯ãããã®ããããã¦å¦ççµæã¨ãã¦ãã¥ã¼ãææ°ã«ãªã£ã¦ãããã©ããããç°¡åã«ã¯ãããã¾ãããã¾ãã¦ã¼ã¶ã¯ææ°ã§ãªãæ
å ±ã«åºã¥ããå¤æã«ãã£ã¦æ°è¦ã³ãã³ããçºè¡ãã¦ãã¾ãå¯è½æ§ãããã¾ããã¦ã¼ã¶ã¯ã©ã®ããã«ã³ãã³ãã®å®è¡ç¶æ³ãç¥ãã®ã§ããããï¼
Q5: æ¶ããªãã¤ãã³ãã¨ã¤ãã³ãã®ãã¼ã¸ã§ãã³ã°
ãªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ã§ããã°ã¹ãã¼ãã¯Alteræã§å¤æ´ãããã¨ãã§ãã¾ããä¸æ¹ãã¤ãã³ããä¸æ¬¡æ
å ±ã¨ãã¦æ°¸ç¶åããã¤ãã³ãã½ã¼ã·ã³ã°ã§ã¯ããã¨ããã°ã«ããééã£ãã¤ãã³ãã§ãååã¨ãã¦æ¶ãã¾ããããããä¸æ¹ã§ã¯GDPRã«ã代表ãããããã«æ¶å»ã¯ã¦ã¼ã¶ã¼ã®æ¨©å©ã§ããããå¾ã¾ããã©ã®ããã«ã¤ãã³ãããã£ã³ã»ã«ããã®ã§ããããï¼ã¾ãã¤ãã³ãã®ãã¼ã¸ã§ã³ã¢ããã¯ã©ã®ããã«å®ç¾ãããè¯ãã®ã§ããããï¼
Q6: ãµã¼ãã¹éã®é£æºããã¸ãã¹ããã»ã¹ã«ç¦ç¹ãå®ã¦ãè¨è¨ããã¹ããä¸å¯æ¬ (å¾ç¶ç·¨ã«ã¦)
ã¢ããªã·ãã¯ãªã·ã¹ãã ã¨ã¯ç°ãªãããã¤ã¯ããµã¼ãã¹ã§ã¯ãµã¼ãã¹ãå調ãã¦å
¨ä½ã¨ãã¦ãã¸ãã¹ããã»ã¹ãå®ç¾ãããã®ã§ããµã¼ãã¹éã®ãããã³ã«ãããã§å©ç¨ãããã¡ãã»ã¼ã¸ã®è¨è¨ãéè¦ã¨ãªãã¾ããã¾ããµã¼ãã¹ãã¨ã«ãã¼ã«ã«ãã¼ã¿ãã¼ã¹ãåå¨ããããã«ããµã¼ãã¹ãã¾ãããå®å
¨ãªä¸è²«æ§ãä¿ã£ããã©ã³ã¶ã¯ã·ã§ã³ã¯å®ç¾ã§ãã¾ãããããã¦ãã¸ãã¹ããã»ã¹ã¯é常è¤æ°ã®ãµã¼ãã¹ã«ã¾ããã£ã¦å®ç¾ããããããåå¥ã®ãµã¼ãã¹ã§ã®ãã¼ã«ã«ãã©ã³ã¶ã¯ã·ã§ã³ãçµã¿åããã¦ããã¼ã¿ã®æ´åãã¨ããªãããã¸ãã¹ããã»ã¹ãå®äºãªããã°ãªãã¾ãããã©ã®ããã«å®ç¾ãããè¯ãã®ã§ããããï¼ï¼ããã«ã¤ãã¦ã¯å¥éå¾ç¶ç·¨ã§èª¬æãã¾ãï¼
対å¦æ¹æ³
ããã§ã¯ããããã®çåã«å¯¾ãã¦å¯¾å¦æ³ãè¦ã¦ããã¾ãããããã®ã¾ã¾é©ç¨ã§ããå®å ¨ãªè§£æ±ºçã°ããã§ã¯ããã¾ããããå¯è½ãªéããã³ãã¨ãªããã¨ãè¨è¼ããããã«ãã¾ãããå®éã®éçºã«é©ç¨ããã«ã¯åèæç®ãåããã¦åç §ãã¦ãã ããã
Q1: ã¡ãã»ã¼ã¸ã¯éè¤é ä¿¡ããããã¨ããã
ã¢ããªã±ã¼ã·ã§ã³ã§ã®åªçæ§ã®èæ ®
ãã¤ã¯ããµã¼ãã¹ã§ã¯ãµã¼ãã¹åå¥ã«ãã¼ã¿ãã¼ã¹ãæã¡ããã¼ã¿ãã¼ã¹ãããã¯ã¡ãã»ã¼ã¸ã³ã°ããã¼ã«ã¼ã®æ©è½ä¸ã®å¶ç´ããããã©ã¼ãã³ã¹ããã¦ä¿¡é ¼æ§ã®çç±ãããåæ£ãã©ã³ã¶ã¯ã·ã§ã³ã¯å©ç¨ããã¾ããã
ãããã®ãµã¼ãã¹ãã¡ãã»ã¼ã¸ã³ã°ã·ã¹ãã ã®éã§ã¡ãã»ã¼ã¸ã失ãããªãããã«ããããã«ã¯ãæ§ã ãªã¬ãã«ã®ã¬ã¤ã¤ã¼ã§éä¿¡ãæåãããã¨ã確å®ã«å¤æã§ããã¾ã§ãªãã©ã¤ãè¡ããããã¨ã«ãªãã¾ããããããã»ã¼ã¸ã®éè¤é ä¿¡ãå¼ãèµ·ããåå ã¨ãªããå°ãªãã¨ãï¼å以ä¸(at least once)ãã®é ä¿¡ã¨ãªãã¾ããéã«ããªãã©ã¤ãè¡ããªãå ´åã«ã¯ãã¹ããçºçãããã¨ããããããæ大ã§ãï¼å(at most once)ãã®é ä¿¡ã¨ãªãã¾ããããã«ãªãã©ã¤ã®åæ°ãæéã«ä¸éãè¨ãããªããã¹ããéè¤ãçºçããå¯è½æ§ãããã¾ãã
ã©ããé¸æãããã¯ã·ã¹ãã ã®è¨è¨æ¬¡ç¬¬ã§ããããã¹ãã許ãããªãã±ã¼ã¹ã§ã¯åºæ¬çã«ãå°ãªãã¨ãï¼å以ä¸(at least once)ãã®é ä¿¡ãåæã¨ããéè¤é ä¿¡æã®ãã¼ã¿ä¸æ´åãé²ãããã®è¨è¨ãã¢ããªã±ã¼ã·ã§ã³ã¬ãã«ã§å¿ è¦ã¨ãªãã¾ã(åªçæ§ã®è¨è¨ï¼ã
ããã¯ããããã®ã³ãã³ããã¤ãã³ããã¨ã«èæ ®ããªããã°ãªããªãè¨è¨ã§ã¯ãããã®ã®ãå®éã«ã¯ããã»ã©é »ç¹ã«éè¤ããã¹ããèµ·ããããã§ã¯ããã¾ãããå¤å°ãªããã¼ã¿ä¸æ´åã許容ã§ããå ´åã«ã¯å¯¾çããªãã¦ãè¯ããã¨ãããã¾ããã¾ãæ ªä¾¡æ å ±ãIoTã«ããæ å ±ãªã©ã絶ãéãªãææ°ã®ãã¼ã¿ãéããã¦ãã¦ããã¹ããã¦ããã次ã®ã¡ãã»ã¼ã¸ã®ææ°ç¶æ ã§ä¸æ¸ãããã°å®ç¨ä¸ã¯åé¡ãªãã¨ãã£ãã±ã¼ã¹ãããã¾ããã¾ã"ããã"ãã¿ã³ãªã©ããã¹ãããã¦ããã¸ãã¹ä¸ã®å¤§ããªå½±é¿ã¯ãªããã¦ã¼ã¶ãæ°ãã¤ããã¨ãã«åå®è¡ããã°ããç¨åº¦ã®ã±ã¼ã¹ãããã¾ãã
ãããã¯ãéè¤å¦çãã¦ãçµæããã¾ããã¨å¤ãããªãã¨ãã£ãã±ã¼ã¹ãããã¾ããä¾ãã°ãã¦ã¼ã¶åãã¦ã¼ã¶åã§éè¤ãã¦ä¸æ¸ããã¦ãçµæãå¤ãããªãã¨ãã£ãå ·åã§ããã¾ããããç©æ¥µçã«ç¨ãã¦ãå¿ è¦ã¨ãããææ°ç¶æ ãã¤ãã³ãã«å«ãã¦ãããéè¤å¦çããã¦ãçµæãåãã¨ãªãã¤ãã³ãã«è¨è¨ãã¦ããæ¹æ³ãããã¾ãããã®ããã«ç¡è¦ãããã¯åé¿ããæ¹æ³ãã¾ãã¯æ¤è¨ãã¾ãã
Idempotent Consumer ãã¿ã¼ã³
ã¨ã¯ããããã¸ãã¹ä¸ã®åå¼ã¨ãã¦ãæ£ç¢ºã«ä¸å(exactly once)ãã®å¦çãè¡ããªããã°ãªããªããã¨ãããã¾ãããã®å ´åã«ã¯ãIdempotent Consumer ãã¿ã¼ã³ãå©ç¨ãã¾ãã
åºæ¬çãªèãæ¹ã¨ãã¦ã¯ãã¡ãã»ã¼ã¸ã«ãã©ã³ã¶ã¯ã·ã§ã³IDï¼ãããã¯ãªã¯ã¨ã¹ãIDï¼ãæãããããã«ãã¾ããããã¦åä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãå´ï¼ã§ã¯åããã©ã³ã¶ã¯ã·ã§ã³IDãæã£ãã¡ãã»ã¼ã¸ãé ä¿¡ãããå ´åã«ã¯éè¤ã¨ãã¦ç ´æ£ããããã«ãã¾ããéè¤ã§ã¯ãªãã¡ãã»ã¼ã¸ã¯ããã®å¦çãè¡ãã¨ã¨ãã«åä¸ãã¼ã«ã«ãã©ã³ã¶ã¯ã·ã§ã³å ã§ãã©ã³ã¶ã¯ã·ã§ã³IDãä¿åãã¾ãã
å®è£ æ¹æ³ã«ã¯ããã¤ãæ¹æ³ãããã¾ããããªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ãå©ç¨ãã¦ããå ´åã®åç´ãªæ¹æ³ã¯æ¬¡ã®ãããªãã®ã§ããã¾ãæ°è¦ã«çºçããã³ãã³ããã¤ãã³ãã«ã¯ãã©ã³ã¶ã¯ã·ã§ã³IDã¨ãã¦UUIDãä»ä¸ããããã¦ããããå¾ç¶ã§æ´¾çãã¦çºè¡ãããã¤ãã³ããã³ãã³ãã«ãåãIDã使ãã¾ããããã«ãã¾ããããã¦åä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãå´ï¼ã§ã¯ããªãã¸ã§ã¯ãIDï¼ããæ£ç¢ºã«ã¯éç´ã«ã¼ãã®IDï¼ãããã¯ã³ãã³ãåãã¤ãã³ãåãã¨ã«ãå¦çããã¡ãã»ã¼ã¸ã®IDãæ°æ¥ç¨åº¦ä¿åããããã«ãã¾ããNoSQLãã¤ãã³ãã½ã¼ã·ã³ã°ã§ã¯ãããããç°ãªãæ¹æ³ãç¨ãã¾ããåºæ¬çãªèãæ¹ã¯åãã§ãã
ã¾ããã¤ãã³ãç¹æã®éè¤æé¤ã®æ¹æ³ã¨ãã¦ããªãã¸ã§ã¯ããçºè¡ããã¤ãã³ãã«ï¼ãã©ã³ã¶ã¯ã·ã§ã³IDã§ã¯ãªããï¼ã¤ã³ã¯ãªã¡ã³ã¿ã«ãªã·ã¼ã±ã³ã¹ãã³ãã¼ãã¤ããæ¹æ³ããããã¾ãããã®å ´åãåä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãå´ï¼ã§ã¯ããªãã¸ã§ã¯ããã¨ã«æ大ã®ã·ã¼ã±ã³ã¹ãã³ãã¼ã®ã¿ãä¿åããã°ãããã·ã¼ã±ã³ã¹ãã³ãã¼ä»¥ä¸ã®å¤ãæã¤ã¡ãã»ã¼ã¸ã¯éè¤ã¨ãã¦ç ´æ£ãããã¨ãã§ãã¾ããããã¯åå¥ã®ãªãã¸ã§ã¯ãï¼ããæ£ç¢ºã«ã¯éç´ï¼ã®åä½ã§ãé©åãªæä»å¶å¾¡ãªã©ã«ãããã¤ã³ã¯ãªã¡ã³ã¿ã«ãªã·ã¼ã±ã³ã¹ãã³ãã¼ãã¤ãã³ãã«ä»ä¸ã§ããããã¦åä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãå´ï¼ã«ã¦ã¤ãã³ãã®å¦çé ãæ ä¿ã§ããå ´åã«æå¹ã§ãã
ãã®ããã«éè¤å¦çã®æå¶ã¯ãï¼ã¡ãã»ã¼ã¸ã³ã°ããã¼ã«ã¼ããµã¼ãã¹ã¡ãã·ã¥ãªã©ã®éä¿¡ã®åé¡ã¨ãã¦å®å ¨ã«åé¢ãããã¨ã¯ã§ããªããããï¼ã¢ããªã±ã¼ã·ã§ã³ã¬ãã«ã§ã®åªçæ§ã®è¨è¨ãæ¯æ´ãå«ãã¦æ ä¿ãããå¿ è¦ãããã¾ãã
ãã¼ãï¼ãæ£ç¢ºã«ä¸å(exactly once)ãã®é ä¿¡ã«å©ç¨ã§ãã Kafkaã®æ©è½
[èå³ãªãæ¹ã¯èªã¿é£ã°ãã¦ãã ãã]
Kafkaãå©ç¨ããå ´åã«ã¯ãæ¡ä»¶ã«ãã£ã¦ã¯ç°¡åã«éè¤é ä¿¡ã«å¯¾å¿ã§ããã±ã¼ã¹ãããã¾ãã
åä¸Kafkaã¯ã©ã¹ã¿å ã«ã¦ãï¼ä»ã®ãã¼ã¿ãã¼ã¹ãæ´æ°ããã«ãï¼ã¡ãã»ã¼ã¸ã®éåä¿¡ã¨ãã®å¦çãè¡ããã®ã§ããã°Kafkaã®ãã©ã³ã¶ã¯ã·ã§ã³æ©è½ã使ãã¾ããããã¯ä¾ãã° ã¡ãã»ã¼ã¸å 容ã®å¤æãæ¡å¼µããããããªã±ã¼ã¹ã§å©ç¨ã§ãã¾ãã
ã¾ããKafkaã®ã¡ãã»ã¼ã¸ã«ã¯ããããã¯ã®ãã¼ãã£ã·ã§ã³å ã§ã®ä½ç½®ã表ããªãã»ããå¤ãå«ã¾ãã¦ãã¾ããããããã©ã³ã¶ã¯ã·ã§ã³IDã®ä»£ããã«åä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãï¼ã§ä¿åãã¦å©ç¨ããæ¹æ³ãããã¾ãããããã¯ãªãã»ããã®ä¿åå ã¨ãã¦Kafkaãæä¾ãã__consumer_offsetsãããã¯ãå©ç¨ããã«ãåä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãï¼ã®ãã¼ã¿ãã¼ã¹ã«ä¿åããããã«ãã¦ãã¡ãã»ã¼ã¸å¦çã¨åããã©ã³ã¶ã¯ã·ã§ã³ã®ä¸ã§åæã«ãªãã»ãããã³ãããããæ¹æ³ãããã¾ãããããã¯ãããã¯å ã®åä¸ã¡ãã»ã¼ã¸ãåä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãï¼ã«éè¤ãã¦é ä¿¡ãããã±ã¼ã¹ã«ã¯æå¹ã§ãããããããããã¯ã«å¯¾ãã¦åä¸ã¡ãã»ã¼ã¸ããªãã©ã¤ãªã©ã«ããéä¿¡ããã¦ãå®éã«ã¡ãã»ã¼ã¸ããããã¯å ã«éè¤ãã¦åå¨ãã¦ãã¾ã£ãå ´åã«ã¯æ¤ç¥ã§ãã¾ããã
ä¸æ¹ã§Kafkaããã¼ã«ã¼ã«ã¯ã¡ãã»ã¼ã¸ã®éä¿¡å´(ãããã¥ã¼ãµ)ããã®ãªãã©ã¤ã«ããéè¤ã¡ãã»ã¼ã¸ãæ¤åºããä»çµã¿ï¼enable.idempotence ãªãã·ã§ã³ï¼ãããã¾ãããã®ä»çµã¿ã§ã¯éä¿¡å´(ãããã¥ã¼ãµ)ã®Kafkaã¯ã©ã¤ã¢ã³ãã¯ãã¡ãã»ã¼ã¸ã«ã·ã¼ã±ã³ã¹ãã³ãã¼ï¼ã¨ãããã¥ã¼ãµIDï¼ãã¤ããããã«ãªãã¾ããããã¦éä¿¡å´(ãããã¥ã¼ãµ)ãä½ããã®çç±ã«ãããªãã©ã¤ãããã¨ã«ããéè¤ã¯ãKafkaããã¼ã«ã¼å´ã§æ¤åºãã¦ç ´æ£ããããã«ãªãã¾ãã
ã¨ããããã®æ¹æ³ãå®ç§ã§ã¯ãªããéä¿¡å´(ãããã¥ã¼ãµ)ããã»ã¹ã«é害ãçããåèµ·åãªã©ã«ãã£ã¦Kafkaã¸ã®ã¡ãã»ã¼ã¸éä¿¡ãã®ãã®ãåå®è¡ããããããªç¶æ³ã§ã¯ãï¼æ°ããªãããã¥ã¼ãµIDãå²ãå½ã¦ãããï¼åä¸ã¡ãã»ã¼ã¸ã¨ã¯ã¿ãªãããã«ãããã¯ã«éè¤ãçºçãã¾ããããã«å¯¾å¿ããããã« transactional.id ãæå®ãããã¨ã§åèµ·åã®åå¾ã§åããããã¥ã¼ãµã§ãããã¨ãæ示çã«æå®ãããã¨ãã§ãã¾ããããã®ããã«ã¯ã¢ããªã±ã¼ã·ã§ã³å´ã§ transactional.id ã®ç¶æ管çãå¿ è¦ã¨ãªãã¾ãã
ãã®ããã«Kafkaã«ã¯ããæ£ç¢ºã«ä¸å(exactly once)ãã®é ä¿¡ã®ããã«å©ç¨ã§ããæ©è½ãããã¤ãããã®ã§ãããæ¡ä»¶ãå¶éãããããã«ãå®éã«å©ç¨ã§ãããã©ããã¯ç¶æ³æ¬¡ç¬¬ã§ãã
Q2: ã©ã®ããã«ãµã¼ãã¹å ã®ãã¼ã¿ãã¼ã¹æ´æ°ã¨ã¡ãã»ã¼ã¸çºè¡ãã¢ãããã¯ã«å®ç¾ããã®ãï¼
ãã¼ã¿æ´æ°ã¨ã¤ãã³ãçºè¡ãã¢ãããã¯ã«å®ç¾ãã (Transactional outbox ãã¿ã¼ã³ï¼
ãµã¼ãã¹ã¯ã³ãã³ããåããã¨ããã¼ã¿ãã¼ã¹ãæ´æ°ãã¦åæã«ã¤ãã³ããçºè¡ããå¿ è¦ãããã¾ãããããããåæã«XAãªã©ã®åæ£ãã©ã³ã¶ã¯ã·ã§ã³ã«åå ããããã¨ã¯ã§ãã¾ããããããããã¼ã¿æ´æ°ã¨ã¤ãã³ãçºè¡ãã¢ãããã¯ã«å®ç¾ãã¦ãã·ã¹ãã ã®ãã¼ã¿ä¸æ´åãé¿ããããã«ã¯ Transactional outbox ãã¿ã¼ã³ãå©ç¨ã§ãã¾ãã
ããã¯äºããã¼ã¿ãã¼ã¹ã®ä¸ã«ã¡ãã»ã¼ã¸ãä¸æçã«æ¿å ¥ãããã¨ãã§ããæ¦å¿µçãªãã¥ã¼ã¨ãã¦ã®Outboxãã¼ãã«ãç¨æãã¦ããã¾ãããã®ä¸ã§ãçºè¡ããã¤ãã³ãã¯ãã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿æ´æ°ã¨åããã©ã³ã¶ã¯ã·ã§ã³å ã§Outboxãã¼ãã«ã«æ¿å ¥ãã¦ã³ããããã¾ããããã«ããã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿æ´æ°ã¨ã¤ãã³ãçºè¡ã®ä¸¡æ¹ã確å®ã«è¡ãããï¼ãããã¯ãã¼ã«ããã¯ã«ãã両æ¹ã確å®ã«è¡ãããªãï¼ãã¨ãä¿è¨¼ãã¾ãããã®å¾ã«å¥éãOutbox ãã¼ãã«ã«æ¿å ¥ãããã¤ãã³ããåãåºãã¦Kafkaã®ãããã¯ã¸ã¨ã¡ãã»ã¼ã¸ãéä¿¡ãã¾ãããã®éã«Debeziumãªã©ã®ãã§ã³ã¸ãã¼ã¿ãã£ããã£(CDC)ãå©ç¨ãããã¨ãå¯è½ã§ãã
ãªããoutboxãã¼ãã«ããKafkaã¸ã¨ã¡ãã»ã¼ã¸ã転è¨ããéã®é害ãããã»ã¹ãè½ã¡ã¦åå®è¡ããããããªå ´åã«ãã¡ãã»ã¼ã¸ãéè¤ãã¦çºè¡ãããå¯è½æ§ãããã¾ãããã®ããåè¿°ã®åªçæ§ã®è¨è¨ãåããã¦å¿ è¦ã«ãªããã¨ã«æ³¨æãã¦ãã ããã
ãã¼ãï¼ RESTã®ãããªåæéä¿¡ã§ãåªçæ§ã®èæ ®ãå¿ è¦ãªãã¨ãããã¾ã
ã¨ããã§å°ã話ã¯æ»ã£ã¦ãåªçæ§ã®èæ ®ã¯ã¡ãã»ã¼ã¸ã³ã°ç¹æã®åé¡ã¨ã¯è¨ããªããªã£ã¦ãã¾ããããµã¼ããããã¬ã¼ã«ã¼ããµã¼ãã¹ã¡ãã·ã¥ãAWS step functions ãªã©ã®å©ç¨ã«ãããRESTãªã©ã«ããåæéä¿¡ã§ãã£ã¦ããªãã©ã¤ã§ããï¼å ´åã«ãã£ã¦ã¯ãã¹ããé²ãï¼ç°å¢ãæ´ã£ã¦ãã¾ããããã®ããåæéä¿¡ã®ã±ã¼ã¹ã§ãåªçæ§ã®è¨è¨ãå¿ è¦ã«ãªããã¨ãããã¾ãã
ãããåæéä¿¡ãç¨ãã¦ãµã¼ãã¹éãã¾ãããã¸ãã¹ããã»ã¹ãå®ç¾ãããã¨ã¯å°ãæ éã«ãªã£ãã»ããè¯ãããããã¾ãããSOAã§ã®å¤±æãã¿ã¼ã³ã®ï¼ã¤ã¨ãã¦ããµã¼ãã¹ã横æãã¦ãã¸ãã¹ããã»ã¹ãå®ç¾ããä¸å¤®é権çãªããã»ã¹ç®¡çãã³ã³ããã¼ã«ãææ¾ãããåå¥ãµã¼ãã¹ã«å¯¾ãã¦åæéä¿¡ã«ãã主å¾é¢ä¿ãå¼·ããããããµã¼ãã¹ã«æ¬æ¥ããã¹ãç¥èã¨ã³ã³ããã¼ã«ã奪ã£ã¦éª¨æãã«ãããã¨ãææããã¦ãã¾ãã
Q3: ãµã¼ãã¹ãçºè¡ããã³ãã³ãã«å¯¾ããå¿çãåãåãæ¹æ³
ããããã³ãã³ãã«å¯¾ããå¿çã¨ã¯ï¼
RESTãªã©ã«ããåæéä¿¡ã§ã¯ãã®å ´ã§å¿ççµæãåãåããã¨ãå¯è½ã§ããä¸æ¹ã¡ãã»ã¼ã¸ã³ã°ã§ã¯ãã³ãã³ãã«å¯¾ããæ示çãªå¿çã¨ãããã®ã¯åºæ¬çã«åå¨ãã¾ããï¼ãããä¾å¤çã«åãæ±ãæ¹æ³ã¯å¾è¿°ï¼ã
ãµã¼ãã¹ã¯ä½ããã®ç¶æ å¤æ´ãããã°ã¤ãã³ããçºè¡ãã¾ããã§ããããã³ãã³ãã«ç¶ãã¦çºçããç¶æ å¤æ´ã®ã¤ãã³ããè³¼èªãããã¨ã§ãé åããªããçµæãç¶æ³ãç¥ããã¨ãã§ãã¾ãã
RESTãªã©ã®åæéä¿¡ã§ã¯ãã³ãã³ãã«å¯¾ããå¦çãé·ãã¨ãï¼åç¨åº¦ã§çµãããã¨ãæé»çãªåæã¨ãªã£ã¦ããã人ãä»ããããã»ã¹ãé·æéã®ãã¸ãã¹ããã»ã¹ã¯çºçãã¾ããããè¿ãå¤ã®åãå¤ãé常ã¯ï¼ã¤ã«å®ã¾ãã¾ãããããä¸æ¹ã®éåæãªã³ãã³ãã§ã¯ããããå¶éã¯ãªããæ示çã«è¿ãå¤ãåããããã®å°ç¨ã®ä»çµã¿ãåå¨ããããã§ãããã¾ãããããã¯ãµã¼ãã¹ãçµç¹ã¨å¯¾å¿ãããã®ã ã¨èããã°åãããããããããã¾ãããå®éã®ãµã¼ãã¹ãçµç¹ã§ã¯ãåæéä¿¡ã«æ±ãããããããªï¼åéã§ãã¸ãã¹ä¸ã®æå³ããçµæãæä¾ã§ããæ©è½ã°ããã§ã¯ããã¾ããã
ä¾ãã°æ³¨æã³ãã³ããèããå ´åãã³ãã³ãã®å®å ã®çµç¹ï¼ãµã¼ãã¹ï¼å é¨ã§ã¯å注çç£ãçºæ³¨ã®ããã«æ°æ¥ããããã¸ãã¹ããã»ã¹ãå®è¡ï¼æ´ã«å é¨ã§å注ã¤ãã³ããªã©ã®ç´°ç²åº¦ã¨ããããã¤ãã³ããã³ãã³ããå©ç¨ï¼ããããã¨ãããã¾ããã¾ã注æã³ãã³ãï¼ã¤ã«å¯¾ãã¦ããçºéæ¸ã¤ãã³ããããå°çæ¸ã¤ãã³ããã¨ãã£ãè¤æ°ã®ã¤ãã³ããæéãåãã¦çºçãããã¨ãããã¾ããããã¦æ³¨æå 容ã®ä¸åã«ããããªãã¼ã·ã§ã³ã¨ã©ã¼ããçç£åæ¢ãå¨åº«ç ´æã«ãããå¼å½å¤±æã¤ãã³ããã¨ãã£ããæ§ã ãªåãæã¤ä¾å¤ã¤ãã³ããçºçããå¯è½æ§ãããã¾ãããå½åã®å¼ã³åºãå ã¨ã¯ç°ãªããµã¼ãã¹ããçºè¡ãããã¤ãã³ãã§ãããã¨ãããã¾ãã
ãã®ããã«ã³ãã³ãã«å¯¾ããå¿çã¤ãã³ãã¨ããã®ã¯ãç¶æ³ã«ãã£ã¦æéãåãæ°ããããã¦å¿çå ãµã¼ãã¹ãããç°ãªããã®ã§ãããããããã§ããã³ãã³ãã¨ã¤ãã³ãã®å¯¾å¿é¢ä¿ã¯å®éã®ãã¸ãã¹ãçµç¹ã®ã¤ã³ã¿ã©ã¯ã·ã§ã³ã«å¯¾å¿ãã¦ããããµã¼ãã¹éã«ããã¦åæãå¾ãæ確ãªå¥ç´ã«å¾ããã®ã§ãã
ãããããµã¼ãã¹ã®éã®ã³ãã³ãã¨å¿çã¤ãã³ãã®ç¹°ãè¿ãã®ä¸ã§ãã¸ãã¹ããã»ã¹ãé²è¡ãã¦ããã¾ããå®éã«ãããããã¸ãã¹ä¸ã®æ§ã ãªã¤ãã³ãã«å¯¾å¿ãããã¨ã¯å°é£ã§ã¯ããã¾ãããããããããã¸ã®å¯¾å¿é¢ä¿ãæªããã«ç´æ¥ç¸å¯¾ã§ãããã¨ãéåæã¡ãã»ã¼ã¸ã³ã°ã®ä¾¡å¤ã§ãããã¾ãã
ã³ãã³ãã«å¯¾ããå¿çã¤ãã³ããåãåãæ¹æ³
ã¤ãã³ãã¯ãµã¼ãã¹ã®ç¶æ å¤æ´ãã·ã¹ãã å ¨ä½ã«åãã¦ç¥ãããä»çµã¿ãªã®ã§ãã³ãã³ãã®éä¿¡å ã«åãã¦å°ç¨ã«çºè¡ããããã®ã§ã¯ããã¾ãããéã«è¨ãã°ã³ãã³ãã®éä¿¡å´ãµã¼ãã¹ã¯ãèªèº«ã®èå³ããå種ã®ã¤ãã³ããç£è¦ãã¦åããå¿ è¦ãããã¾ããããã«ã¯æ§ã ãªæ¹æ³ãããã¾ãããããã§ã¯é¢ä¿ããã¤ãã³ããåãåã£ã¦ãã³ãã«ããããã®å ·ä½çãªæ¹æ³ä¾ãããå°ãã ã説æãã¾ãã
é常ã¤ãã³ãã®ä¸ã«ã¯ãå¤æ´ããããªãã¸ã§ã¯ãã®ID(ããæ£ç¢ºã«ã¯éç´ID)ãå«ã¾ãã¦ãããã©ã®ãªãã¸ã§ã¯ãã«å¤æ´ããã£ãã®ãã¯åããã¾ãã
ä¸æ¹ã¤ãã³ããè³¼èªãããµã¼ãã¹ã§ã¯ããã®å é¨ã®ï¼ã¤ï¼ã¾ãã¯è¤æ°ï¼ã®ãªãã¸ã§ã¯ãã«ã¤ãã³ãããã£ã¹ããããããã¨ã«ãªãã¾ãããã®éã«ã¤ãã³ãå 容ãããã£ã¹ãããå ã®ãªãã¸ã§ã¯ããå³åº§ã«ç¹å®ã§ãããã¨ãããã¾ãããããã§ãªãå ´åã«ã¯ãµã¼ãã¹å ã«ããæ å ±ãç¨ãã¦ãã£ã¹ãããå ã®ãªãã¸ã§ã¯ããç¹å®ããªããã°ãªãã¾ããã
ãªãã¸ã§ã¯ããç¹å®ãããããã³ã°æ¹æ³ã¨ãã¦ãã¾ãã¯é¢é£ããå¤é¨ãã¼ã§ãããªãã¸ã§ã¯ãIDï¼ãããã¯ãã¸ãã¹ä¸ã®åè£ãã¼ã¨ãªãä½ããã®No.ãªã©ï¼ãå©ç¨ããæ¹æ³ãããã¾ããä¾ãã°ããããã¤ãã³ããè³¼èªãããµã¼ãã¹å ã®ãªãã¸ã§ã¯ãã«ã¦ãå¤é¨ãã¼ã¨ãã¦ãªãã¸ã§ã¯ãã®IDãä¿æãã¦ããå ´åã«ã¯ããã®é¢é£ãå©ç¨ãã¦ãããã³ã°ãããã¨ãã§ãã¾ããä»ã«ã¯ç¸é¢IDãå©ç¨ããæ¹æ³ãããã¾ããããã¯ã¡ãã»ã¼ã¸IDãåè¿°ã®ãã©ã³ã¶ã¯ã·ã§ã³IDï¼ãããã¯ããã«é¡ããIDï¼ãã³ãã³ãã«ä»ä¸ããã³ãã³ãããé¢é£ãã¦çºçããã¤ãã³ãã«ããããç¸é¢IDã¨ãã¦å¼ãåããç¶ãããã¨ã§ãããã³ã°ãã¾ãã
ãããã³ã°ãå®äºããã¦ãªãã¸ã§ã¯ããç¹å®ããå¾ã¯ãå³åº§ã«ã¤ãã³ããã³ãã©å ã§ãªãã¸ã§ã¯ãã«ã¤ãã³ããå¦çããããã¨ãã§ãã¾ãããåãåã£ãã¤ãã³ããã³ãã³ãã®ãã¥ã¼ï¼ãããã¯ï¼å´ã«å ¥ãç´ãã¦å®è¡ãå¾ ã¤æ¹æ³ãããã¾ããããã¯ï¼æ¦è¦ç·¨ã®æå¾ã®æ¹ã§å°ã触ããããã«ï¼æä»å¶å¾¡ã®ããã«è¤æ°ã®ã¹ã¬ããããåããªãã¸ã§ã¯ããæä½ãããããªãå ´åããï¼ã¤ã®ã¤ãã³ãããå¤æ°ã®ãªãã¸ã§ã¯ãã¸ã¨ãããã³ã°ãå¿ è¦ãªç¶æ³ã§å½¹ã«ç«ã¤ãã¨ãããã¾ãã
ã¾ãã¨ããã§ãããããä½ããã®ä½æãæ示ãããããªã³ãã³ãã§ã¯ãããããç¸æå ãªãã¸ã§ã¯ãããã®IDèªä½ãåå¨ãã¾ããããã®ãããªå ´åã«ã¯ãã³ãã³ãçºè¡å´ã§ç¸æå ãªãã¸ã§ã¯ãã®ID(UUIDãªã©)ã代çä½æãã¦ä¿æãã¦ããããããä½ææ示ã³ãã³ãã§æå®ãããã¨ã§ãç¸æå ãªãã¸ã§ã¯ãã®IDãäºåã«ææ¡ããæ¹æ³ãããã¾ãã
ã¨ã¯ããã³ãã³ãã®å¿çãæ示çã«åããã
ã³ãã³ãã«å¯¾ããå¿çãã¡ãã»ã¼ã¸ã³ã°ã§åããããªãã®ã¯ã©ããã¦ãå°ãã±ã¼ã¹ãããããããã¾ãããåæéä¿¡ã®ããã«ã³ãã³ãã®å®è¡çµæãæ示çã«åããæ¹æ³ã¨ãã¦ãï¼ã¤ãã³ãã®ãããã¯ãéããã«ãï¼ã³ãã³ãçµæãå°éã«åãããã¥ã¼ï¼ãããã¯ï¼ãç¨æããæ¹æ³ãããã¾ãããã®å ´åããµã¼ãã¹ã®ã³ãã³ãçµæã¯ï¼ã¤ãã³ãã¨ã¯å¥ã«ãï¼ãã®å°ç¨ã®ãã¥ã¼ã«ç¸é¢IDãã¤ããã¡ãã»ã¼ã¸ã¨ãã¦å¿çãã¾ãã
ãã®æ¹æ³ã¯ãç¹å®ã®ã³ãã³ããå¼ã³åºãå ã«ç¹åããçµæãã¡ãã»ã¼ã¸ã«ä»å ãããã¨ãã§ããã¾ãã³ãã³ãã¨ã©ã¼ãªã©ã§ç¶æ å¤æ´ããªãå ´åã§ãçµæãåãåãã¾ããããã¦å¥éå¾è¿°ããSAGAãå®è£ ããããã«ãå½¹ç«ã¤ãã¨ãããã¾ããããããµã¼ãã¹éã®ä¾åé¢ä¿ãå¼·åºãªãã®ã«ãã¦ãã¾ãå¾åãããããã«å©ç¨ã«ã¯æ³¨æãå¿ è¦ã§ãã
ãªããããããå®è¡çµæãåã«ä¼ãããããªã¡ãã»ã¼ã¸ã¯ãã³ãã³ããã¤ãã³ãã¨ã¯å½¹å²ãç°ãªããããããã¥ã¡ã³ãã¨å¼ã°ãã¦åºå¥ããããã¨ãããã¾ãã
Q4: ã¦ã¼ã¶ãã³ãã³ãã®å®è¡ç¶æ³ãææ¡ããæ¹æ³
ãã¥ã¼ãéãã¦ç¶æ ãç¥ã
å¤ãã®ã¢ããªã·ãã¯ãªã·ã¹ãã ã§ã¯ã³ãã³ãã¯åæå¦çãããå¿çãè¿ã£ã¦ããæã«ã¯å¦çã¯å®äºããå®äºç»é¢ã«å¦ççµæã表示ãããå¯è½ã§ããããããã¡ãã»ã¼ã¸ã³ã°ã«ããéåæãªã³ãã³ãã§ã¯ãã³ãã³ãã¯ãã¥ã¼ï¼ãããã¯ï¼ã«å ¥ãããã¤ã³ãã³ããå¦çãããã®ãããããã¯ãããã®ãã¯ç°¡åã«ã¯åããã¾ããã
ã³ãã³ãã®çµæã¨ãã¦ã¦ã¼ã¶ã«å¯¾ããæ確ãªå¿çã¯ãªãã¨ãããã¸ãã¹ããã»ã¹ã®é²æã«å¿ãã¦ããµã¼ãã¹å ã®ãªãã¸ã§ã¯ãç¶æ ãé常ã¯å¤ãã£ã¦ããã¾ããã§ãããã³ãã³ãã®è¿ãå¤ã§ã¯ãªãããã¥ã¼ãããããã®ãªãã¸ã§ã¯ãã®ç¶æ ãåç §ãããã¨ã§é²æã確èªãããã¨ãã§ãã¾ããå®éã®ã¨ããã¡ãã»ã¼ã¸ã³ã°ã«ããã·ã¹ãã ã§ã¯ãã³ãã³ãã®å®è¡å®äºã«ç¶ãã¦æ§ã ãªã¤ãã³ããçºçããªããå¾ç¶å¦çé²ãã§ããããã«ãã³ãã³ãèªä½ã®å®äºã«ã¯ãã¾ãæå³ããããã®ã§ã¯ããã¾ãããï¼å®äºç»é¢ã¸ã®é·ç§»ã¨ããããã¯ï¼ä¸è¦§ç»é¢ã詳細ç»é¢ãªã©ããæ§ã ãªãªãã¸ã§ã¯ãã®ã¹ãã¼ã¿ã¹ããã¤ã§ã確èªã§ããããã«ãã¾ãã
åå¥ã¦ã¼ã¶åãã®ã¡ã¼ã«ããã¯ã¹ã®æä¾
ãããåå¥ã¦ã¼ã¶ã¸ã®éç¥ãå¿ è¦ãªããåã¦ã¼ã¶ãã¨ã«ã¡ã¼ã«ããã¯ã¹ãæä¾ããããã¸ã³ãã³ãæå¦ãé²æç¶æ³ãéç¥ããæ¹æ³ãããã¾ããããã¯å®éã«ã¡ã¼ã«ã§éç¥ããæ¹æ³ãããã°ããã¤ãã¼ã¸ã®ãããªã¨ããããæ±ç¨çã«éç¥ãåç §/管çã§ããã¡ã¼ã«ããã¯ã¹ãç¨æããæ¹æ³ãããã¾ããã¾ãåå¥ã®è¦ä»¶ã«ç¹åããåã¦ã¼ã¶åãã®ãã¥ã¼ï¼å人ã®æ³¨æå±¥æ´ãç³è«å±¥æ´ãªã©ï¼ãéçºãããã¨ãã§ãã¾ãã
ããã«ãã¦ã¼ã¶ã®å©ç¨ãã¦ããç»é¢ãããã¤ã¹ã¸ã¨éç¥ãå¿ è¦ãªããWebSocketãgRPCã®ã¹ããªã¼ã ãç¨ãã¦ãã³ãã³ããçºè¡ããã¦ã¼ã¶ã®ç»é¢ãããã¤ã¹ã«éç¥ããã¼ã¿è»¢éãããã¨ãã§ãã¾ãããã¼ã¿ããã¨ãã¦ã®Kafkaã¯ç¶æ å¤åã®ã¤ãã³ããæ§ã ãªãµã¼ãã¹ã«é ä¿¡ãããã¨ãã§ãã¾ãããããã¯å®ã®ã¨ãããã¼ã¿ã»ã³ã¿ã¼å ã«ã¨ã©ã¾ããã®ã§ã¯ããã¾ãããã¯ã©ã¤ã¢ã³ãã®ç»é¢ãããã¤ã¹ã¸ã¨åæ§ã«ã¤ãã³ãã®ããã·ã¥ç¯å²ãåºããããã¤ã¹å ã«ãã¥ã¼ãä½æãã¦ç»é¢è¡¨ç¤ºãããã¨ãå¯è½ã§ããå¤ãã®ã¯ã©ã¤ã¢ã³ãã§ã¯ããããããã¥ã¼ã¢ãã«ãã¤ãã³ããåãæ±ãããã®ååãªãã¬ã¼ã ã¯ã¼ã¯ãã©ã¤ãã©ãªãæ¢ã«æã£ã¦ãã¾ãã
ã¯ã©ã¤ã¢ã³ãå´ã§ã®ããªãã¼ã·ã§ã³
ã¨ããã§ç¾å®çãªåé¡ã¨ãã¦ãã¦ã¼ã¶ã®å®è¡ããã³ãã³ããä½ããã®ä¸åã«ãã£ã¦ããªãã¼ã·ã§ã³ã«ããã¨ã©ã¼ã¨ãªã£ãå ´åã«ã¯ããã¯ãå³åº§ã«ã¦ã¼ã¶ã¸ã¨éç¥ã§ããªããã°ä¸ä¾¿ãªãã¨ãããã¾ãããã®ããã¯ã©ã¤ã¢ã³ãå´ã§ã®äºåã®ããªãã¼ã·ã§ã³ãç¹ã«æå¹ã§ãã
ããã«ã¯ã³ãã³ãå®è¡ã®æ¡ä»¶ãæºãããªãå ´åã«ãã¯ã©ã¤ã¢ã³ãç»é¢å´ã§é¸æã§ããæ°å¤ãå¶éãããããã¿ã³ãæ¼ããªãããã«ãããã¨ããWEBãµã¼ãã§ç°¡æããªãã¼ã·ã§ã³ãè¡ããã¨ãå«ã¾ãã¾ãããªãææ°ãã¼ã¿ã¯ãµã¼ãã¹å´ã«ãããªãã®ã§ãããããäºåã®ããªãã¼ã·ã§ã³ã«ãéçãããããµã¼ãã¹å´ã§ã®ããªãã¼ã·ã§ã³ãåããã¦å¿ è¦ã§ãã
ããã«ãã£ã¦ããªãã¼ã·ã§ã³ãã¸ãã¯ãã¯ã©ã¤ã¢ã³ãå´ã¨ãµã¼ãã¹ã«åæ£ãã¾ãããããããã¯ã©ã¤ã¢ã³ãå´ã¸ã®ãã¸ãã¯æµåºãåé¿ããæ¹æ³ã¨ãã¦ããã¥ã¼ã«ããªãã¼ã·ã§ã³ãè£å©ããæ å ±ãæãããæ¹æ³ãããã¾ããä¾ãã°ãã¥ã¼ã«ã注æã®å¤æ´ãå¯è½ãã©ãããã¾ããã£ã³ã»ã«ãå¯è½ãã©ãããã¨ãã£ããã©ã°ãæãããã¯ã©ã¤ã¢ã³ãç»é¢ã§ã¯ãã®ãã©ã°ãåºã«ãã¿ã³ã®æå¹ç¡å¹ãå¤æããããã«ãã¾ããã¢ããªã·ãã¯ãªã·ã¹ãã ã¨ã¯ç°ãªããã¤ãã³ãã½ã¼ã·ã³ã°ã®å ´åã«ã¯æ§ã ãªç®çã«ç¹åãããã¥ã¼ããããã§ãã«ã¸ã¥ã¢ã«ã«ä½æãã¦å©ç¨ããããã«ãªãã¾ãã
ã¾ããã¤ãã³ãã½ã¼ã·ã³ã°ã§ã¯éç´ãè¶ ããåä½ã§ã®ããªãã¼ã·ã§ã³ï¼ä¾ãã°ã¦ã¼ã¶åã®ã¦ãã¼ã¯ãã§ãã¯ãªã©ï¼ã¯é£ããå¾åãããããããã®ãããªå ´åã«ã¯ãã¥ã¼ãç¨ããã¯ã©ã¤ã¢ã³ãå´ã§ã®ããªãã¼ã·ã§ã³ãéè¦ã«ãªãã¾ãã
楽観çããã¯ã§ææ°æ å ±ã«ããå¤æãå¼·å¶ãã
ã¡ãã»ã¼ã¸ã³ã°ã«ããã¦ã¯ããã¥ã¼ãææ°ã«ãªã£ã¦ãããã©ããç°¡åã«ã¯ãããã¾ãããã¦ã¼ã¶ã¯ææ°ã§ãªãæ å ±ã«åºã¥ããå¤æã«ãã£ã¦æ°è¦ã³ãã³ããçºè¡ãã¦ãã¾ãå¯è½æ§ããã¿ã¤ãã³ã°æªãä»ã®ã¦ã¼ã¶ãæ¢ã«å¥ã³ãã³ãã§æ示ãã¦ãããã¨ãããã¾ãã
ããã¯ã¡ãã»ã¼ã¸ã³ã°ã«ç¹æã®åé¡ã§ã¯ãªããä¸è¬çãªéçç»é¢ã®ãã©ã¦ã¶ã¢ããªãªã©ã§ãèµ·ãããã¨ã§ãããããããå ´åã¨åæ§ã«æ¥½è¦³çããã¯ã«ãããã¼ã¸ã§ã³ãã§ãã¯ãè¡ã£ã¦è§£æ±ºãããã¨ãã§ãã¾ããããã¯äºãç»é¢ã«æ¸¡ãåã¬ã³ã¼ããæ å ±ã«ãã¼ã¸ã§ã³çªå·ããããã¦ããã¾ããããã¦ãã³ãã³ãçºè¡æã«ã¯ãã®ãã¼ã¸ã§ã³çªå·ããããã¦éä¿¡ãããµã¼ãã¹å´ã§ã¯å¯¾è±¡ã¬ã³ã¼ãã®ãã¼ã¸ã§ã³çªå·ãåãå ´åã«ã®ã¿ã³ãã³ãã®å¦çãè¡ãã¾ããããããã¼ã¸ã§ã³çªå·ãç°ãªã£ã¦ããã°ãææ°ã®æ å ±ã«åºã¥ãå¤æã§ãªããããããã¯ã¿ã¤ãã³ã°æªãä»ã®ã¦ã¼ã¶ãåããªãã¸ã§ã¯ããæ¢ã«æ´æ°ããã¨ãã¦ãã³ãã³ããã¨ã©ã¼ã«ãã¾ãã
Q5: æ¶ããªãã¤ãã³ãã¨ã¤ãã³ãã®ãã¼ã¸ã§ãã³ã°
ééã£ãã¤ãã³ããç¡å¹ã«ãã
ãªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ã§ããã°ãã¹ãã¼ãã¯Alteræã§å¤æ´ãããã¨ãã§ãã¾ããä¸æ¹ãã¤ãã³ããä¸æ¬¡æ å ±ã¨ãã¦æ°¸ç¶åããã¤ãã³ãã½ã¼ã·ã³ã°ã§ã¯ååã¨ãã¦ã¤ãã³ãã¯æ¶ãã¾ãããããã¯ã¤ãã³ãããã¸ãã¹ä¸ã®ç£æ»ãã°ã®æå³åãã¨ãªãã ãã§ãªããå®è£ ä¸ãä¸è²«ãã¦ã¤ãã³ããã¤ãã¥ã¼ã¿ãã«ã«ãããã¨ã§ãé²åãç¶ããå種ãã¥ã¼ãç¹°ãè¿ãå°åºããããã«å¿ è¦ãªãã¨ã§ãããã¾ãã
ããã注æãåé¤ããã¨ããããã¸ãã¹ä¸èãããããã¨ã§ããã°ãåã«ã注æåé¤ã¤ãã³ãããçºè¡ããã°ãã¤ãã³ããã°ã«ã¯ããã追è¨ãããããã¦ãã®ã¤ãã³ããè³¼èªãããã¥ã¼ã¯ã注æã«åé¤ãã©ã°ãç«ã¦ããããããã¯å®éã«ãã¥ã¼ã®ãã¼ã¿ãã¼ã¹ããã¬ã³ã¼ãåé¤ãããã¨ãã§ãã¾ãã
ã§ã¯ãããããã°ã«ãã£ã¦ééã£ã¦ä½æããã¦ãã¾ã£ãã¤ãã³ãã¯ã©ããããè¯ãã®ã§ããããããã®å ´åãã£ã³ã»ã«ã¤ãã³ããå©ç¨ããæ¹æ³ãããã¾ããããã¯ãã£ã³ã»ã«å¯¾è±¡ã®ã¤ãã³ãã¸ã®ãªã³ã¯ã¨ããã£ã³ã»ã«çç±ã®ããã¹ããå«ãããã£ã³ã»ã«ã¤ãã³ããä½æããã¨ãããã®ã§ãã
ã¾ããGDPRã«ã代表ãããããã«å人æ å ±ã®æ¶å»ãã¦ã¼ã¶ã«æ±ããããå ´åã«ãããã¯ãã¤ãã³ãèªä½ã¯åé¤ãã¾ããããã®ãããªå ´åã«ã¯äºãã¤ãã³ãã®æå·åãè¡ã£ã¦ãããã¦ã¼ã¶æ å ±ã®å¾©å·åã«å¿ è¦ãªæå·åãã¼ãåé¤ãã¾ãã復å·æ段ããªãããã¨ã§äºå®ä¸ã®åé¤ãè¡ãã¾ãã
ã¤ãã³ãã®ãã¼ã¸ã§ã³ã¢ãã
å種ã®ã¢ãã«ããã¥ã¼ã¯ã·ã¹ãã ã®æé·ã«å¿ãã¦é²åãç¶ããä¸æ¹ã§ãã¤ãã³ãã½ã¼ã·ã³ã°ã«ããã¦ã¯ãã¤ãã³ãã¯ã·ã¹ãã ã®ã©ã¤ããµã¤ã¯ã«å ¨ä½ã«æ¸¡ã£ã¦åºæ¬çã«ã¯åé¤ãå¤æ´ãè¡ããã¾ããããã®ããã¤ãã³ããæ¡å¼µããå ´åã«ã¯ãå¾æ¥ã®ã¤ãã³ãã¨æ°ããã¤ãã³ããã·ã¹ãã å ã«å ±åãããããã«ãã¼ã¸ã§ã³ç®¡çãå¿ è¦ã¨ãªãã¾ãã
ãã¼ã¸ã§ã³ã¢ããéã§ã®äºææ§ãå¾ãç°¡åãªæ¹æ³ã¨ãã¦ã¯ãã¤ãã³ãã®ã·ãªã¢ã©ã¤ãºãã©ã¼ãããã¨ãã¦ãJSONãXMLãAvroãprotobufsãªã©ã®å¼±ãã¹ãã¼ã(Weak Schema)ãå©ç¨ããæ¹æ³ãããã¾ãããã®å ´åãã£ã¼ã«ãã®è¿½å ãªã©ã®ããã¤ãã®å¤æ´ã«é¢ãã¦ã¯äºææ§ãå¾ããã¨ãã§ãã¾ãã
ããããã£ã¼ã«ãåã®å¤æ´ãªã©ãå¼±ãã¹ãã¼ãã§ã¯å¯¾å¿ã§ããªããã¼ã¸ã§ã³ã¢ãããããã¾ãããã®å ´åã«ã¯ãã¤ãã³ãã«ãã¼ã¸ã§ã³çªå·ãã¤ãã¦ãã¡ãã»ã¼ã¸ã®åä¿¡å´ï¼ã³ã³ã·ã¥ã¼ãï¼ã«ã¦ã¢ããªã±ã¼ã·ã§ã³ãç解ã§ããã¤ãã³ãã«ããã¦ã³ãã£ã¹ããã¢ãããã£ã¹ããããä»çµã¿ãå®è£ ãããã¨ã«ãªãã¾ãããã ããããããã¤ãã³ãã®å¤æã³ã¼ããéãªãç¶ããã°è² ã®éºç£ã«ãªãå¾ã¾ãã
åºæ¬çã«ã¯ã¤ãã³ãã¯åé¤ã§ããªããã®ã§ãããã¨ã¯ããä¸é½åãªãã¨ãããããããã¾ããããã¾ãç©æ¥µçã«ãå§ãã§ããªãã¨ããã¦ãã¾ãããå ¨ã¤ãã³ããç½®ãæããæ¹æ³ ( Copy and Replace )ãããã¾ãã詳細ã¯ããã§ã¯å²æãã¾ãããVersioning in an Event Sourced Systemãæ¸ç±ã®ä¸ã§ãä¸è¨ãå«ãæ§ã ãªãã¼ã¸ã§ã³æ´æ°ã®ãã¯ããã¯ãæé ãç´¹ä»ããã¦ãã¾ãã®ã§èå³ããæ¹ã¯ã覧ãã ããã
ã¾ã¨ã
ä»åã®çåç·¨ã§ã¯ãã¡ãã»ã¼ã¸ã³ã°ã«é¢ãã¦è¯ãçåã¨ããããã¨ã¨ãã®ä¸»ãªè§£æ±ºæ¹æ³ã説æãã¦ãã¾ãããã¾ãã¡ãã»ã¼ã¸ã®éè¤é ä¿¡ã¸ã®å¯¾å¦æ¹æ³ã¨ãã¦åªçæ§ã®è¨è¨ãIdempotent Consumerãã¿ã¼ã³ã«ã¤ãã¦ç¢ºèªãã¾ãããããã¦ãã¢ããªã±ã¼ã·ã§ã³å¦çã¨ã¡ãã»ã¼ã¸çºè¡ãã¢ãããã¯ã«è¡ãTransactional outbox ãã¿ã¼ã³ã説æãã¾ããããã®å¾ãã³ãã³ãã«ããã¦ããããå¿çã¨ã¯ä½ããããã¦ãã®å¿çã¤ãã³ããåããæ¹æ³ã«ã¤ãã¦ã説æãã¾ãããã¾ããã¦ã¼ã¶ãã³ãã³ãã®å®è¡ç¶æ³ãç¥ãæ¹æ³ããé¢é£ãã¦ã¯ã©ã¤ã¢ã³ãå´ã§ã®ããªãã¼ã·ã§ã³ãæå¹ã§ãããã¨ã確èªãã¾ãããããã¦æå¾ã«ã¤ãã³ããç¡å¹ã«ãããã£ã³ã»ã«ã¤ãã³ãã®ãã¯ããã¯ããç°¡åãªããã¤ãã³ãã®ãã¼ã¸ã§ãã³ã°ã«ã¤ãã¦ã触ãã¾ããã
ãããããã¨éåæã¡ãã»ã¼ã¸ã³ã°ã¯é¢åãããã¨æã£ãããããã¾ãããå®éé¢åãããã®ã§ãããããã¯éåæã¡ãã»ã¼ã¸ã³ã°ãåæéä¿¡ã¨ã¯ç°ãªãã¬ãã«ã§ããã¸ãã¹ä¸ã¨æè¡ä¸ã®åé¡ã«åãçµãã§ããããã§ãããã¾ãã
次åã¯ãçµææ´åæ§ãä¿ã£ããã©ã³ã¶ã¯ã·ã§ã³ãããµã¼ãã¹éã®é£æºããã¸ãã¹ããã»ã¹ã«ç¦ç¹ãå®ã¦ãè¨è¨ã¨ãã¦ãSAGAãEventStormingã«ã¤ãã¦èª¬æãããã¨æãã¾ããé¢é£ãã¦ç¾å¨ã®ã·ã¹ãã éçºã§ä¸»æµã¨ãªã£ã¦ãããªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ã¨ãã¼ã¿ä¸å¿ã®è¨è¨ã«å¯¾ããè¦åã«ã¤ãã¦ããããã触ãããã¨æã£ã¦ãã¾ããï¼ã¨ã¯ããä»åã®å 容ãå½åã¯å ¨ãæ¸ãæ°ã®ãªãã£ããã¨ã°ããããèªåèªèº«ä»åã®è¨äºã®ã¹ã³ã¼ããããåãããªããªã£ã¦ãã¦ã次åã®å 容ãã§ãã¨ãåè² ãªã®ã§ãã¾ãæå¾ ããªãã§ãã ãããã次ã¯ãã¤é ã«ãªãããªãããï¼
Special Thanks
åå¼·ä¼ã§ã®è°è«ããã®è¨äºã®åºã«ãªã£ã¦ãã¾ããåå è ã®æ¹ã ãããã¦ã¬ãã¥ã¼ãã¦ãã ãã£ãæ¹ã ãã©ãããããã¨ããããã¾ããï¼
åèæç®
- Microservices Patterns
- Introducing EventStorming
- Versioning in an Event Sourced System
- Enterprise Integration Patterns
- Designing Event-Driven Systems
- Domain Modeling Made Functional
- Exploring CQRS and Event Sourcing
- UMLã«ãããã¸ãã¹ã¢ããªã³ã°
[PR]
- ãªã¼ãã³ã½ã¼ã¹ã®Apache Kafkaããã¼ã¹ã¨ãã製åã¨ãã¦ãRed HatããAMQ Streamsãæä¾ããã¦ãã¾ããAMQ Streamsã«ã¯ããã«ãKubernetesãOpenShiftã®ä¸ã§Apache Kafkaã®éç¨ã®èªååãå®ç¾ããããªã¼ãã³ã½ã¼ã¹ã®Strimziããã¼ã¹ã¨ããæ©è½ãå«ã¾ãã¦ãã¾ããRed Hat製åã«èå³ãªãæ¹ãKubernetesãå©ç¨ãã¦ããæ¹ã¯Strimziããã²ä½¿ã£ã¦ã¿ã¦ãã ããã