{"id":50332,"date":"2023-10-31T05:53:11","date_gmt":"2023-09-06T10:36:21","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/"},"modified":"2024-01-15T13:12:52","modified_gmt":"2024-01-15T05:12:52","slug":"%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/","title":{"rendered":"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b"},"content":{"rendered":"<p>\u8bf7\u8c05\u89e3\uff0c\u7531\u4e8e\u8fd9\u662f\u4e00\u4e9b\u6742\u4e71\u7684\u7b14\u8bb0\uff0c\u6240\u4ee5\u53ef\u80fd\u4f1a\u5b58\u5728\u9519\u8bef\u3002<\/p>\n<h1>&#8220;Lagom\u662f\u4ec0\u4e48\u610f\u601d\uff1f&#8221;<\/h1>\n<p>\u300c\u8fd9\u4e2a\u7edd\u5bf9\u662f\u4e00\u4e2a\u9876\u7ea7\u7684\u5fae\u670d\u52a1\u6846\u67b6\uff01\uff01\u300d\u5728\u5b98\u65b9\u7f51\u7ad9\u4e0a\u5927\u5b57\u4f53\u5199\u7740\uff0c\u4f46\u662f\u6211\u5bf9\u5fae\u670d\u52a1\u672c\u8eab\u5e76\u4e0d\u4e86\u89e3\uff0c\u6240\u4ee5\u5148\u4e0d\u7ba1\u5b83\u3002\u6839\u636e\u6211\u7684\u8bd5\u7528\u611f\u89c9\u6765\u770b\uff0c\u5b83\u597d\u50cf\u53ef\u4ee5\u58f0\u660e\u6027\u5730\u5b9e\u73b0CQRS+ES\u7684\u673a\u5236\u5462\uff5e\u8fd9\u662f\u6211\u7684\u5370\u8c61\u3002<\/p>\n<h1>\u5148\u8bd5\u8bd5\u770b\u8fd0\u884c\u8d77\u6765<\/h1>\n<p>\u9996\u5148\u6309\u7167\u8fd9\u91cc\u5199\u7684\u6b65\u9aa4\u6765\u64cd\u4f5c\u4e00\u4e0b\u3002<br \/>\nhttps:\/\/www.lagomframework.com\/get-started-scala.html<\/p>\n<p>\u5f53\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95eehttp:\/\/localhost:9000\/api\/hello\/World\u65f6\uff0c\u5e94\u8be5\u4f1a\u663e\u793a&#8221;\u4f60\u597d\uff0c\u4e16\u754c\uff01&#8221;\u3002<\/p>\n<h1>\u8fd8\u6709\u5176\u4ed6\u6837\u54c1\u5417\uff1f<\/h1>\n<p>\u5982\u679c\u9605\u8bfb\u793a\u4f8b\u4ee3\u7801\uff0c\u6b63\u5982\u6240\u8ff0\uff0c\u53ef\u4ee5\u901a\u8fc7Post\u65b9\u6cd5\u6765\u4fee\u6539\u201cHello\u201d\u90e8\u5206\u3002\u4f8b\u5982\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"post-pre\"><code>curl <span class=\"nt\">-H<\/span> <span class=\"s2\">\"Content-Type: application\/json\"<\/span> <span class=\"nt\">-X<\/span> POST <span class=\"nt\">-d<\/span> <span class=\"s1\">'{\"message\":\"Goodbye and Goodnight\"}'<\/span> http:\/\/localhost:9000\/api\/hello\/Kenny\r\n<\/code><\/pre>\n<p>\u5f53\u6211\u8bbf\u95ee http:\/\/localhost:9000\/api\/hello\/Kenny \u65f6\uff0c\u6d88\u606f\u53d8\u4e3a\u201c\u518d\u89c1\uff0c\u665a\u5b89\uff0cKenny\uff01\u201d\uff08\u987a\u4fbf\u8bf4\u4e00\u53e5\uff0c\u4f5c\u8005\u662f\u4e2a\u4f2a\u6454\u8ff7\uff09\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u53ea\u6709\u5728Kenny\u7684\u65f6\u5019\u624d\u6709\u6240\u6539\u53d8\uff08\u5f53\u8bbf\u95eehttp:\/\/localhost:9000\/api\/hello\/World\u65f6\uff0c\u4f1a\u663e\u793a\u201cHello, World\uff01\u201d\uff09\u3002\u6211\u60f3\u8fd9\u53ef\u80fd\u662f\u5c06\u6570\u636e\u8bb0\u5f55\u5728\u80cc\u540e\u8fd0\u884c\u7684Cassandra\u670d\u52a1\u5668\u4e2d\u3002<\/p>\n<p>\u53ea\u9700\u5b89\u88c5\u4e00\u4e2a\u540d\u4e3awscat\u7684WebSocket\u5ba2\u6237\u7aef\uff0c\u7136\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5e76\u8f93\u5165\u5b57\u7b26\u4e32\uff0c\u5b83\u5c06\u8fd4\u56de\u54cd\u5e94\u3002<\/p>\n<pre class=\"post-pre\"><code>wscat -c ws:\/\/localhost:9000\/stream\r\nconnected (press CTRL+C to quit)\r\n&gt; Doilux\r\n&lt; Hello, Doilux!\r\n&gt; Kenny\r\n&lt; Goodbye and Goodnight, Kenny!\r\n<\/code><\/pre>\n<h1>\u5728\u54ea\u91cc\u5b9e\u65bd\u7684\uff1f<\/h1>\n<p>\u524d\u8ff0\u63d0\u5230\u7684\u975eWebSocket\u7684\u90e8\u5206\uff0c\u5728hello-lagom-api\u5b50\u9879\u76ee\u7684HellolagomService.scala\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e86\u63a5\u53e3\uff0c\u5728hello-lagom-impl\u5b50\u9879\u76ee\u7684HellolagomServiceImpl.scala\u6587\u4ef6\u4e2d\u7f16\u5199\u4e86\u5b9e\u73b0\u3002<\/p>\n<p>WebSocket\u7684\u5185\u5bb9\u53ef\u4ee5\u5728hello-lagom-stream-api\u5b50\u9879\u76ee\u7684HellolagomStreamService.scala\u4e2d\u627e\u5230\u63a5\u53e3\uff0c\u5728hello-lagom-stream-impl\u5b50\u9879\u76ee\u7684HellolagomStreamServiceImpl.scala\u4e2d\u627e\u5230\u5b9e\u73b0\u3002<\/p>\n<p>\u6211\u8ba4\u4e3a\u5728*Loader.scala\u6587\u4ef6\u4e2d\u5199\u6709\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\uff0c\u4ee5\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u786e\u5b9a\u4e86\u63cf\u8ff0\u3002<\/p>\n<h1>\u4e0b\u4e00\u4e2a\u662f\u4ec0\u4e48\uff1f<\/h1>\n<p>\u56e0\u4e3a\u6587\u6863\u5f88\u5145\u5b9e\uff0c\u6240\u4ee5\u6211\u89c9\u5f97\u5148\u8bfb\u6587\u6863\uff0c\u8fb9\u8bd5\u8fb9\u5c1d\u8bd5\u5404\u79cd\u60c5\u51b5\u662f\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff08\u6211\u4e5f\u662f\u8fd9\u6837\u8bd5\u8fc7\u5f88\u591a\u4e1c\u897f\uff09\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u6211\u975e\u5e38\u6709\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u8c05\u89e3\uff0c\u7531\u4e8e\u8fd9\u662f\u4e00\u4e9b\u6742\u4e71\u7684\u7b14\u8bb0\uff0c\u6240\u4ee5\u53ef\u80fd\u4f1a\u5b58\u5728\u9519\u8bef\u3002 &#8220;Lagom\u662f\u4ec0\u4e48\u610f\u601d\uff1f&#8221; \u300c\u8fd9 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-50332","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5c1d\u8bd5\u8fd0\u884c-lagom-\u7684\u793a\u4f8b\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b\" \/>\n<meta property=\"og:description\" content=\"\u8bf7\u8c05\u89e3\uff0c\u7531\u4e8e\u8fd9\u662f\u4e00\u4e9b\u6742\u4e71\u7684\u7b14\u8bb0\uff0c\u6240\u4ee5\u53ef\u80fd\u4f1a\u5b58\u5728\u9519\u8bef\u3002 &#8220;Lagom\u662f\u4ec0\u4e48\u610f\u601d\uff1f&#8221; \u300c\u8fd9 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5c1d\u8bd5\u8fd0\u884c-lagom-\u7684\u793a\u4f8b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-06T10:36:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T05:12:52+00:00\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/\",\"name\":\"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-09-06T10:36:21+00:00\",\"dateModified\":\"2024-01-15T05:12:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5c1d\u8bd5\u8fd0\u884c-lagom-\u7684\u793a\u4f8b\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b","og_description":"\u8bf7\u8c05\u89e3\uff0c\u7531\u4e8e\u8fd9\u662f\u4e00\u4e9b\u6742\u4e71\u7684\u7b14\u8bb0\uff0c\u6240\u4ee5\u53ef\u80fd\u4f1a\u5b58\u5728\u9519\u8bef\u3002 &#8220;Lagom\u662f\u4ec0\u4e48\u610f\u601d\uff1f&#8221; \u300c\u8fd9 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5c1d\u8bd5\u8fd0\u884c-lagom-\u7684\u793a\u4f8b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-09-06T10:36:21+00:00","article_modified_time":"2024-01-15T05:12:52+00:00","author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/","name":"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-09-06T10:36:21+00:00","dateModified":"2024-01-15T05:12:52+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5c1d\u8bd5\u8fd0\u884c Lagom \u7684\u793a\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%9d%e8%af%95%e8%bf%90%e8%a1%8c-lagom-%e7%9a%84%e7%a4%ba%e4%be%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=50332"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50332\/revisions"}],"predecessor-version":[{"id":59778,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50332\/revisions\/59778"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=50332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=50332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=50332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}