ã泚æ 翻蚳è ã ãã®èšäºã¯ãç¹ã«äœæ¥ã倧éã®ããŒã¿ãæ±ãå Žåã«ããã€ã¯ããµãŒãã¹ã«åºã¥ããŠãœãªã¥ãŒã·ã§ã³ãæ§ç¯ããããšãèšç»ããŠããããŸãã¯çŸåšã®ãœãªã¥ãŒã·ã§ã³ãæé©åããæ¹æ³ãæ¢ããŠããã¢ãŒããã¯ããšéçºè ã«ãšã£ãŠèå³æ·±ããã®ã§ãã ãã®ç¿»èš³ã¯ãApache Igniteã®ãã€ã¯ããµãŒãã¹ã«é¢ããäžé£ã®èšäºã®ããŒã1ãšããŒã2ã«åºã¥ããŠããŸãã Javaãšã³ã·ã¹ãã ã®äžè¬çãªç¥èãããããšãåæãšããŠããŸãïŒApache Igniteã¯.NETãC ++ãRESTããã³ä»ã®èšèªã§ãåäœããŸãããèšäºã®äŸã¯Javaã«ã¢ããŒã«ããŸãïŒãSpringã®åºæ¬çãªç¥èãæšå¥šãããŸãã
ä»æ¥ã ãã€ã¯ããµãŒãã¹ã¢ãŒããã¯ãã£ã¯ãå€ãã®äŒæ¥ããœãªã¥ãŒã·ã§ã³ãæ§ç¯ããäžã§æãäžè¬çãªã¢ãããŒãã®1ã€ã§ãã ãã®ã¢ãããŒãã®äž»ãªå©ç¹ã®1ã€ã¯ããœãªã¥ãŒã·ã§ã³ãäžé£ã®ççµåã³ã³ããŒãã³ãïŒãã€ã¯ããµãŒãã¹ïŒã«åå²ããããšã§ããåã³ã³ããŒãã³ãã«ã¯ãç¬èªã®ã©ã€ããµã€ã¯ã«ãšãªãªãŒã¹ãµã€ã¯ã«ãéçºããŒã ãªã©ããããŸãã ãããã®ã³ã³ããŒãã³ãã«ã¯åžžã«ããã€ã¯ããµãŒãã¹ãçžäºã«ããåãããããã®å°ãªããšã1ã€ã®ããŒã¿äº€æã¡ã«ããºã ããããŸãã ããã«ãç¹å®ã®ã·ã¹ãã ã¢ãžã¥ãŒã«ã«æé©ãªããŸããŸãªèšèªãšãã¯ãããžã䜿çšããŠäœæã§ããŸãã
é«è² è·ã®ãããã€ã¯ããµãŒãã¹ã¢ãŒããã¯ãã£ã«åºã¥ããœãªã¥ãŒã·ã§ã³ã䜿çšãã掻çºã«æé·ããããŒã¿ã¢ã¬ã€ã§äœæ¥ããå¿ èŠãããå Žåãããããå€å žçãªã¢ãããŒãã®åé¡ã«ééãããããŸãã¯ééããã§ãããã
- ãã£ã¹ã¯ããŒã¿ããŒã¹ã¯ãæ ŒçŽããã³åŠçããå¿ èŠãããæ å ±éã®å¢å€§ã«å¯Ÿå¿ã§ããŸããã ããŒã¿ããŒã¹ãããã«ããã¯ã«ãªãã決å®ããæ®ãããŸãã
- ãã€ãŠãã±ãŒãã®äžã®ãã§ãªãŒãã ã£ãé«å¯çšæ§ã®èŠä»¶ã¯ãçŸåšãåžå Žã§æåãåããã補åã«ãšã£ãŠå¿ èŠãªæå°èŠä»¶ã§ãã
ãã®èšäºã®ç®çã¯ãApache IgniteïŒãŸãã¯GridGain In-Memory Data FabricïŒã䜿çšããŠè£œåã®ãããã®åé¡ã解決ãããã€ã¯ããµãŒãã¹ãã©ãã€ã ã§ãã©ãŒã«ããã¬ã©ã³ãã§ã¹ã±ãŒã©ãã«ãªãœãªã¥ãŒã·ã§ã³ãæ§ç¯ããæ¹æ³ã説æããããšã§ãã
Apache Igniteã«åºã¥ãããœãªã¥ãŒã·ã§ã³ã®è§£æ
äžã®å³ã«ç€ºãããã«ãApache Igniteã䜿çšããå žåçãªãã€ã¯ããµãŒãã¹ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãã£ãèŠãŠã¿ãŸãããã
Apache Ignite Cluster Layer
Apache Igniteã¯ã©ã¹ã¿ãŒã¯ã2ã€ã®ç®æšãéæããããã«äœ¿çšãããŸãã
ãŸããããã¯ã¡ã€ã³ããŒã¿ãŠã§ã¢ããŠã¹ã§ãããRAMã«ä¿åãããŸãã ããŒã¿ã¯ã¡ã¢ãªå ã«ããããããã€ã¯ããµãŒãã¹ã¯DBMSãä»ããŠéæ¥çã«å€ãã®é«äŸ¡ãªãã£ã¹ã¯ã¢ã¯ã»ã¹ãå®è¡ããå¿ èŠããªããã·ã¹ãã å šäœã®ããã©ãŒãã³ã¹ãå€§å¹ ã«åäžããŸãã
ã ããŒã¿ããŒã ãã¯ãããŒã¿ãä¿åãã圹å²ãæ ãã¯ã©ã¹ã¿ãŒå ã®ç¹å¥ãªã°ã«ãŒãã§ãã ãããã¯ãããŒã¿ã»ã¯ã·ã§ã³ãæ ŒçŽãããããã®ã»ã¯ã·ã§ã³ã§ã®ããŒã¿ååŸããã³èšç®èŠæ±ã®å®è¡ãå¯èœã«ããããµãŒããŒãApache IgniteããŒãã§ãã ããŒã¿ããã³èšç®ã¯ã©ã¹ããããã€ããå¿ èŠã¯ãããŸãããApacheIgniteã¯ç¬èªã®ã¯ãã¹ãã©ãããã©ãŒã ãã€ããªåœ¢åŒã«äŸåããŠãããã¯ã©ã¹ã¿ãŒããŒãéã§ããžãã¯ãšã¯ã©ã¹ã亀æããã¡ã«ããºã ãåããŠããŸãïŒãã¢ã¯ã©ã¹ã®èªã¿èŸŒã¿ïŒã
Apache Igniteãã€ããªåœ¢åŒã¯ããªããžã§ã¯ããã·ãªã¢ã«åããããŒãéã®ã¯ã©ã¹ã®åçãªäº€æããµããŒãããããã«äœ¿çšãããŸãã ãã®ãããªã¯ã©ã¹ã¿ãŒå ã§ã®ããžãã¯ã®äº€æã®å¯èœæ§ã«ãããããžãã¹ããžãã¯ãå«ããµãŒãã¹ããŒãã®å¥ã®ã¬ã€ã€ãŒãããªã³ããã³ãã§å¿ èŠãªã³ãŒããããŠã³ããŒãããããšã«ãããèšç®ãæè»ã«ç®¡çã§ããŸãã
第äºã«ãã¯ã©ã¹ã¿ãŒã¯ãã€ã¯ããµãŒãã¹ã®ã©ã€ããµã€ã¯ã«ã管çãããã€ã¯ããµãŒãã¹ãšããŒã¿ããŒãéã®çžäºäœçšã«å¿ èŠãªãã¹ãŠã®APIãæäŸããŸãã
ãã®ãœãªã¥ãŒã·ã§ã³ã§ã¯ãApache Igniteã¯ã©ã¹ã¿ãŒã«åºã¥ããŠããµãŒãã¹ããŒãã䜿çšãããŸãã ãããã¯ãå¿ èŠãªããžãã¹ããžãã¯ãå«ããã€ã¯ããµãŒãã¹ã³ãŒããå±éãããããŒãã§ãã ç¹å®ã®ãœãªã¥ãŒã·ã§ã³ã®æ©èœã«å¿ããŠã1ã€ã®ããŒãã«1ã€ä»¥äžã®ãã€ã¯ããµãŒãã¹ãå«ãŸããå ŽåããããŸãã
åãã€ã¯ããµãŒãã¹ã¯ãµãŒãã¹ã€ã³ã¿ãŒãã§ãŒã¹ãå®è£ ããApache IgniteããŒãã«ç»é²ããŸãããã®åŸãã¯ã©ã¹ã¿ãŒã®å éšã¡ã«ããºã ããã©ãŒã«ããã¬ã©ã³ã¹ãæäŸããã¯ã©ã¹ã¿ãŒã®ä»ã®éšåãããã€ã¯ããµãŒãã¹ãåŒã³åºã䟿å©ãªã¡ã«ããºã ãæäŸããŸãã Apache Igniteã¯ããµãŒãã¹ããŒãã«ãã€ã¯ããµãŒãã¹ã®1ã€ä»¥äžã®ã³ããŒããããã€ããŸãã ã¯ã©ã¹ã¿ãŒã®å éšã¡ã«ããºã ã¯ãè² è·åæ£ãšãã©ãŒã«ããã¬ã©ã³ã¹ãæäŸããŸãã
äžã®å³ã§ã¯ããã€ã¯ããµãŒãã¹ã¯MS <N>ïŒMS1ãMS2ãªã©ïŒãšããŠããŒã¯ãããŠããŸãã ãµãŒãã¹ããŒããšããŒã¿ããŒãéã®ããžãã¯ã®åé¢ã«ãããMS1ãã€ã¯ããµãŒãã¹ãæŽæ°ããå¿ èŠãããå Žåãã¯ã©ã¹ã¿ãŒå šäœãåèµ·åããå¿ èŠããªããªããŸãã å¿ èŠãªã®ã¯ããããã€ãããŠãããµãŒãã¹ããŒãã§MS1ã¯ã©ã¹ãæŽæ°ããããšã ãã§ãã ããã«ãããŒãã®ãµãã»ããã®ã¿ãåèµ·åããå¿ èŠããããã·ã¹ãã ãžã®æœåšçãªåœ±é¿ãæå°éã«æããŸãã
ãã¹ãŠã®ããŒãïŒãµãŒãã¹ãšããŒã¿ïŒã¯åäžã®ã¯ã©ã¹ã¿ãŒã«çžäºæ¥ç¶ãããŠãããããããããŒãã«å±éãããMS1ã¯ãå¥ã®ïŒãŸãã¯åãïŒããŒãã«å±éãããä»ã®ãã€ã¯ããµãŒãã¹ãšããåãããä»»æã®ããŒãã«ããŒã¿ãšèšç®ãéåä¿¡ã§ããŸãããŒã¿ã
æ°žç¶ã¬ã€ã€ãŒ
ãã®ã¬ã€ã€ãŒã¯ãªãã·ã§ã³ã§ããã次ã®ãããªã·ããªãªã§äœ¿çšã§ããŸãã
- æå³ããªããªããããã¹ãŠã®ããŒã¿ãã¡ã¢ãªã«ä¿æããããšã¯äžå¯èœã§ãã
- ã¯ã©ã¹ã¿ãŒãå®å šã«ã¯ã©ãã·ã¥ããå ŽåããŸãã¯ã¯ã©ã¹ã¿ãŒãåèµ·åããå¿ èŠãããå Žåã«åããŠããã£ã¹ã¯äžã®ã³ããŒããããŒã¿ãå埩ã§ããå¿ èŠããããŸãã
æ°žç¶ããŒã¿ã¬ã€ã€ãŒã䜿çšããã«ã¯ãApache Igniteã®CacheStoreã€ã³ã¿ãŒãã§ã€ã¹ã®å®è£ ãæå®ããå¿ èŠããããŸãã ããã©ã«ãã®å®è£ ã®äžã«ã¯ãMongoDBãCassandraãªã©ã®ããŸããŸãªãªã¬ãŒã·ã§ãã«DBMSããããŸãã
å€éšã¢ããªã±ãŒã·ã§ã³ãšã®çžäºäœçšã®å±€
ããã¯ãã€ã¯ããµãŒãã¹ã®ãã¯ã©ã€ã¢ã³ããå±€ã§ããã1ã€ä»¥äžã®ãã€ã¯ããµãŒãã¹ãåŒã³åºãããšã«ããããã®å±€ããããŸããŸãªå®è¡ãã©ã³ããéå§ãããŸãã
ãã®å±€ã¯ãç¹å®ã®ãã€ã¯ããµãŒãã¹ã«åºæã®ãããã³ã«ã䜿çšããŠããã€ã¯ããµãŒãã¹ãšéä¿¡ã§ããŸãã åæã«ããã®ã¢ãŒããã¯ãã£ãœãªã¥ãŒã·ã§ã³ã®ãã¬ãŒã ã¯ãŒã¯å ã§ããã€ã¯ããµãŒãã¹ã¯Apache Igniteã¡ã«ããºã ã䜿çšããŠçžäºã«éä¿¡ããŸãã
ãã®ã¢ãŒããã¯ãã£ã¯ãæ°Žå¹³æ¹åã«æ¡åŒµããæ©èœãæäŸããã¡ã¢ãªã«ããŒã¿ãä¿åã§ããããã«ãããã€ã¯ããµãŒãã¹ã®é«å¯çšæ§ãä¿èšŒããŸãã
å®è£ äŸ
以äžã¯ãApache Igniteã¯ã©ã¹ã¿ãŒã®æåã®ã¬ã€ã€ãŒã®å¯èœãªå®è£ ã§ãã 䜿çšããã³ãŒãã¯ã https ïŒ //github.com/dmagda/MicroServicesExampleã§è¡šç€ºã§ããŸã ã
ç¹ã«ã次ã®æ¹æ³ã瀺ãããŸãã
- ããŒã¿ããŒãã®ã»ããã¢ãããšå®è¡
- Apache Ignite Service Grid APIã䜿çšããŠãµãŒãã¹ãå®è£ ããŸãã
- ãµãŒãã¹ããŒããæ§æããŠå®è¡ããŸãã
- ã¯ã©ã¹ã¿ãŒã«æ¥ç¶ãããµãŒãã¹ã®å®è¡ãéå§ããã¢ããªã±ãŒã·ã§ã³ãïŒæãåçŽãªåœ¢åŒã§ïŒäœæããŸãã
ããŒã¿ããŒã
äžèšã®ããã«ãããŒã¿ããŒãã¯ããŒã¿ãå«ãApache IgniteãµãŒããŒããŒãã§ãããã¢ããªã±ãŒã·ã§ã³ã®ããžãã¹ããžãã¯ã«ãã£ãŠéå§ãããã¯ãšãªãšèšç®ãå®è¡ã§ããŸãã ããŒã¿ããŒãã¯ããžãã¹ããžãã¯ãã解æŸãããããŒã¿ã¹ãã¬ãŒãžãšåŠçã¡ã«ããºã ã®ã¿ãã«ãã»ã«åããå€éšããã®ç¹å®ã®ãªã¯ãšã¹ããåãå ¥ããŸãã
äŸã䜿çšããŠããã®ãããªããŒãã®äœæãèŠãŠã¿ãŸãããã ãããè¡ãã«ã¯ãåè¿°ã®GitHubãããžã§ã¯ããããŠã³ããŒãããå¿ èŠããããŸãã
ãããžã§ã¯ãã§data-node-config.xmlãã¡ã€ã«ãèŠã€ããŸãã ãã®ãã¡ã€ã«ã¯ãæ°ããããŒã¿ããŒããéå§ããããã«äœ¿çšãããŸãã ãã®äžã«ãã¯ã©ã¹ã¿ãŒã«ãããã€ããå¿ èŠã®ãããã£ãã·ã¥ã®å®çŸ©ãããã³ããŒã¿ããŒãã«åºæã®ä»ã®èšå®ãèŠãããšãã§ããŸãã äž»ãªãã®ãæ€èšããŠãã ããã
ã泚æ 翻蚳è ã Apache Igniteã®XMLæ§æã¯ãSpringã䜿çšããŠãªããžã§ã¯ãããªãŒãæ§ç¯ããŸãã èªè ãSpringã®æ§æã«æ £ããŠããªãå Žåãå¿ èŠãªæ å ±ã¯ãããšãã°ã å ¬åŒææž ïŒè±èªïŒãŸãã¯ãã¬ãŒãã³ã°è³æããå ¥æã§ããŸãã åœç¶ãIgniteConfigurationãçŽæ¥äœæããããšããSpringã¡ã«ããºã ã䜿çšãããããã泚éãŸãã¯Groovyãã€ã¢ã¬ã¯ãã«åºã¥ããŠæ§æãæ§ç¯ããããšãã§ããŸãã
ãŸãããã®æ§æã§ã¯ããã£ãã·ã¥ããšã«ãã©ã®Apache IgniteããŒãã«æ å ±ãå«ãããã決å®ãããã£ã«ã¿ãŒãã€ã³ã¹ããŒã«ãããŸãã ãã®ãã£ã«ã¿ãŒã¯ãããŒããã¯ã©ã¹ã¿ãŒã«åå ããããã¯ã©ã¹ã¿ãŒããé¢è±ãããšãã«ãããããžãŒãå€æŽããããã³ã«é©çšãããŸãã ãã£ã«ã¿ãŒå®è£ ã¯ãããŒã¿ããŒãã§ã¯ãªãããŒããå«ãã¯ã©ã¹ã¿ãŒå ã®ãã¹ãŠã®ããŒãã®ã¯ã©ã¹ãã¹ã«ãããã€ããå¿ èŠããããã¯ã©ã¹ãã¹ã§ã¢ã¯ã»ã¹ã§ããå¿ èŠããããŸãã
<bean class="org.apache.ignite.configuration.CacheConfiguration"> ... <property name="nodeFilter"> <bean class="common.filters.DataNodeFilter"/> </property> </bean>
次ã«ãäžã§å®çŸ©ãããã£ã«ã¿ãŒã¯ã©ã¹ãå®è£ ãããŸãã ãã®äŸã§ã¯ãããŒããããŒã¿ã®ä¿åãæ åœãããã©ããã®åºæºãããŒããdata.nodeãã®å±æ§ã§ããå ŽåãæãåçŽãªã¢ãããŒãã®1ã€ã䜿çšãããŸãã ãã®å±æ§ãtrueã«èšå®ãããŠããå ŽåãããŒãã¯ããŒã¿ããŒããšèŠãªããããããã¯ãŒã¯äžã®ãã£ãã·ã¥ãå«ãŸããŸãã ããããªããšãã¯ã©ã¹ã¿ãŒå šäœã«ããŒã¿ãé åžãããšãã«ããŒããç¡èŠãããŸãã
public boolean apply(ClusterNode node) { Boolean dataNode = node.attribute("data.node"); return dataNode != null && dataNode; }
第äžã«ãæ§æã¯ãèµ·åæã«ãã®æ§æã䜿çšããåããŒãã®ãdata.nodeããã©ã¡ãŒã¿ãŒã®å€ãå®çŸ©ããŸãã
<property name="userAttributes"> <map key-type="java.lang.String" value-type="java.lang.Boolean"> <entry key="data.node" value="true"/> </map> </property>
DataNodeStartupã¯ã©ã¹ã䜿çšããŠããŒã¿ããŒããèµ·åããããignite.shãŸãã¯ignite.batã¹ã¯ãªããã䜿çšããŠãdata-node-config.xmlã§å®çŸ©ãããæ§æãåŒæ°ãšããŠæž¡ããŸãã åŸè ã®å Žåãæåã«java / app / commonã®ã¯ã©ã¹ãå«ãJARãã¡ã€ã«ãã¢ã»ã³ãã«ãããã®JARãã¡ã€ã«ãåããŒã¿ããŒãã®ã¯ã©ã¹ãã¹ã«é 眮ããããšãå¿ããªãã§ãã ããã
ãµãŒãã¹ããŒã
æ§æã«é¢ããŠã¯ããµãŒãã¹ããŒãã¯åã®ã»ã¯ã·ã§ã³ã®ããŒã¿ããŒããšããã»ã©å€ãããŸããã åæ§ã«ãApache IgniteããŒãã®ãµãã»ãããå²ãåœãŠãåºæºã決å®ããå¿ èŠããããŸããããã®ãµãã»ããã¯ããŒã¿ã¹ãã¬ãŒãžã§ã¯ãªãããã€ã¯ããµãŒãã¹ã®åäœãæ åœããŸãã
æåã«ã Apache Ignite Service Grid APIã䜿çšããŠãã€ã¯ããµãŒãã¹ãå®çŸ©ããå¿ èŠããããŸã ã èšäºã®äžéšãšããŠãGitHubã®ãªããžããªã«é©çšãããMaintenanceServiceã®äŸãæ€èšããŸãã
ãµãŒãã¹ã€ã³ã¿ãŒãã§ã€ã¹ã¯æ¬¡ã®ãšããã§ãã
public interface MaintenanceService extends Service { public Date scheduleVehicleMaintenance(int vehicleId); public List<Maintenance> getMaintenanceRecords(int vehicleId); }
ãµãŒãã¹ã§ã¯ããã·ã³ã®ã¡ã³ããã³ã¹ãèšç»ããããå²ãåœãŠããããµãŒãã¹ã®ãªã¹ããåä¿¡ãããã§ããŸãã å®è£ ã«ã¯ãããžãã¹ããžãã¯ã«å ããŠãinitïŒ...ïŒãexecuteïŒ...ïŒãcancelïŒ...ïŒãªã©ã®Service Gridåºæã®ã¡ãœããã®å®çŸ©ãå«ãŸããŠããŸãã
ã¯ã©ã¹ã¿ã®ãµãã»ããã§ãã®ãã€ã¯ããµãŒãã¹ãå ¬éããã«ã¯ãããã€ãã®æ¹æ³ããããŸãã äŸã®äžã§äœ¿çšããããããã®1ã€ã¯ãæ§æãã¡ã€ã«maintenance-service-node-config.xmlãå®çŸ©ãããã®æ§æãã¡ã€ã«ãšã¯ã©ã¹ãã¹äžã®å¿ èŠãªã¯ã©ã¹ã§ãµãŒãã¹ããŒããéå§ããããšã§ãã ãã®å Žåãæ§æã¯æ¬¡ã®ããã«ãªããŸãã
ãŸãããµãŒãã¹ããŒããä»ã®ãµãŒãã¹ããŒããšåºå¥ãããã£ã«ã¿ãŒãå®çŸ©ãããŠããŸãã
<bean class="org.apache.ignite.services.ServiceConfiguration"> <property name="nodeFilter"> <bean class="common.filters.MaintenanceServiceFilter"/> </property> </bean>
ãã£ã«ã¿ãŒã®å®è£ ã¯æ¬¡ã®ãšããã§ãã
public boolean apply(ClusterNode node) { Boolean dataNode = node.attribute("maintenance.service.node"); return dataNode != null && dataNode; }
ãã®å®è£ ã§ã¯ãåºæºã¯ãããŒãã®å±æ§ãmaintenance.service.nodeããtrueã«èšå®ãããŠãããã©ããã§ãã
æåŸã«ãããŒãã¯æ¬¡ã®maintenance-service-node-config.xmlæ§æã»ã¯ã·ã§ã³ãä»ããŠãã®å±æ§ãåãåããŸãã
<property name="userAttributes"> <map key-type="java.lang.String" value-type="java.lang.Boolean"> <entry key="maintenance.service.node" value="true"/> </map> </property>
ã泚æ 翻蚳è ã ãµãŒãã¹ãé 眮ãããšããäºå®ã¯ãæ§æããã®ä»¥äžã®ã³ãŒãã«ãã£ãŠèšå®ãããŸãã serviceConfigurationã«ã¯ããã®ããŒãã«çè«çã«å±éã§ãããµãŒãã¹ããªã¹ããããŸãã
ãµãŒãã¹ã®nameããããã£ã¯ãã¯ã©ã¹ã¿ãŒå ã®äžæã®ååãæ åœããŸããããšãã°ããµãŒãã¹ãããã·ãä»ããŠãµãŒãã¹ã«ã¢ã¯ã»ã¹ã§ããŸãããµãŒãã¹ããããã£ã¯ããµãŒãã¹ããžãã¯ãå®è£ ããã¯ã©ã¹ãåç §ããtotalCountããã³maxPerNodeCountããããã£ã¯ããµããŒãããå¿ èŠã®ããã€ã³ã¹ã¿ã³ã¹ã®åèšæ°ã瀺ããããããç¹å®ã®ããŒãäžã®ã€ã³ã¹ã¿ã³ã¹ã®æ倧蚱容æ°ã ãã®å Žåãã·ã³ã°ã«ãã³ã¯ã©ã¹ã¿ãŒãæ§æãããŸããã»ã°ã¡ã³ãåãããŠããªãã¯ã©ã¹ã¿ãŒå ã§ã¯ããµãŒãã¹ã®ã€ã³ã¹ã¿ã³ã¹ã¯åžžã«1ã€ã ãã§ãã
<property name="serviceConfiguration"> <list> <!-- MaintenanceService. --> <bean class="org.apache.ignite.services.ServiceConfiguration"> <!-- --> <property name="name" value="MaintenanceService"/> <!-- , --> <property name="service"> <bean class="services.maintenance.MaintenanceServiceImpl"/> </property> <!-- --> <property name="totalCount" value="1"/> <!-- , --> <property name="maxPerNodeCount" value="1"/> ⊠</bean> </list> </property>
MaintenanceServiceNodeStartupã䜿çšããŠãµãŒãã¹ããŒãã®è€æ°ã®ã€ã³ã¹ã¿ã³ã¹ãèµ·åãããã maintenance-service-node-config.xmlãignite.shãŸãã¯ignite.batã«æž¡ããæåã«åããŒãã®ã¯ã©ã¹ãã¹ã«java / app / commonããã³java / services / maintenanceãããã¹ãŠã®å¿ èŠãªã¯ã©ã¹ãé 眮ããŸãã
GitHubã®ãªããžããªã§VehicleServiceãµãŒãã¹ã®äŸãèŠã€ããããšãã§ããŸãã VehicleServiceNodeStartupã¯ã©ã¹ã䜿çšããããæåã«ã¯ã©ã¹ãã¹ã«ãã¹ãŠã®å¿ èŠãªã¯ã©ã¹ãé 眮ããåŸã vehicle-service-node-config.xmlãã¡ã€ã«ãignite.shãŸãã¯ignite.batã«æž¡ãããšã«ããããã®ãµãŒãã¹ã®ã€ã³ã¹ã¿ã³ã¹ãéå§ã§ããŸãã
å¿çšäŸ
Maintenance Serviceããã³VehicleServiceãµãŒãã¹ãå«ããµãŒãã¹ããŒããšåæ§ã«ããŒã¿ããŒããæ§æããèµ·åããæºåãã§ããããåæ£ãã€ã¯ããµãŒãã¹ã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã䜿çšããæåã®ã¢ããªã±ãŒã·ã§ã³ãèµ·åã§ããŸãã
ãããè¡ãã«ã¯ãGitHubãªããžããªããTestAppStartupãã¡ã€ã«ãå®è¡ããŸãã ã¢ããªã±ãŒã·ã§ã³ã¯ã¯ã©ã¹ã¿ãŒã«åå ãããã£ãã·ã¥ãããŒã¿ã§æºãããå±éããããã€ã¯ããµãŒãã¹ã§æäœãå®è¡ããŸãã
ãµãŒãã¹ã§æäœãå®è¡ããããã®ã³ãŒãã¯æ¬¡ã®ãšããã§ãã
MaintenanceService maintenanceService = ignite.services().serviceProxy( MaintenanceService.SERVICE_NAME, MaintenanceService.class, false); int vehicleId = rand.nextInt(maxVehicles); Date date = maintenanceService.scheduleVehicleMaintenance(vehicleId);
ã芧ã®ãšãããã¢ããªã±ãŒã·ã§ã³ã¯ãµãŒãã¹ãããã·ã䜿çšããŠãµãŒãã¹ã§åäœããŸãã ãã®ã¢ãããŒãã®å©ç¹ã¯ãã¯ã©ã€ã¢ã³ãã®åœ¹å²ãæãããŠããããŒãããã¯ã©ã¹ãã¹ã«ããŒã«ã«ã«ãããã€ããããµãŒãã¹å®è£ ã¯ã©ã¹ãæã£ãŠããå¿ èŠããªãããšã§ã-ã€ã³ã¿ãŒãã§ãŒã¹ã¯ã©ã¹ã ãã§ååã§ã-ãããŠãããŒã«ã«ã§ãµãŒãã¹ãå®è¡ããå¿ èŠã¯ãããŸããïŒãããã·ã¯ããªã¢ãŒãå®è£ ãšã®ééçãªå¯Ÿè©±ãæäŸããŸãã
ãããã«
ãã®èšäºã§ã¯ãApache Igniteäžã§ã®ãã€ã¯ããµãŒãã¹ã®äœ¿çšãå«ãã¢ãŒããã¯ãã£ãæ€èšãããã®ã¢ãŒããã¯ãã£ãå®è£ ãããµã³ãã«ã¢ããªã±ãŒã·ã§ã³ãæ€èšããŸããã 次ã®èšäºã§ã¯ãã¯ã©ã¹ã¿ãŒãæ°žç¶ããŒã¿ã¹ãã¬ãŒãžã®ã¬ã€ã€ãŒã«é¢é£ä»ããæ¹æ³ãããã³å€éšã¢ããªã±ãŒã·ã§ã³ãšã®å¯Ÿè©±ã®ã¬ã€ã€ãŒã匷調ããæ¹æ³ã«ã€ããŠèª¬æããŸãã