{"id":23560,"date":"2024-11-27T22:07:33","date_gmt":"2024-11-27T15:07:33","guid":{"rendered":"https:\/\/huongdanjava.com\/?p=23560"},"modified":"2024-11-28T05:36:32","modified_gmt":"2024-11-27T22:36:32","slug":"service-invocation-voi-dapr","status":"publish","type":"post","link":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html","title":{"rendered":"Service Invocation v\u1edbi Dapr"},"content":{"rendered":"<p>Trong <a href=\"https:\/\/huongdanjava.com\/vi\/cai-dat-dapr-distributed-application-runtime.html\" target=\"_blank\" rel=\"noopener\">b\u00e0i vi\u1ebft tr\u01b0\u1edbc<\/a>, m\u00ecnh \u0111\u00e3 h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch c\u00e0i \u0111\u1eb7t Dapr. \u0110\u1ec3 h\u00ecnh dung c\u00e1ch ho\u1ea1t \u0111\u1ed9ng c\u1ee7a Dapr nh\u01b0 th\u1ebf n\u00e0o, ch\u00fang ta h\u00e3y c\u00f9ng nhau l\u00e0m m\u1ed9t v\u00ed d\u1ee5 v\u1ec1 Service Invocation v\u1edbi Dapr c\u00e1c b\u1ea1n nh\u00e9!<\/p>\n<p>Dapr ho\u1ea1t \u0111\u1ed9ng \u0111\u00f3ng vai tr\u00f2 l\u00e0 m\u1ed9t sidecar c\u00f9ng v\u1edbi \u1ee9ng d\u1ee5ng, n\u00ean cho v\u00ed d\u1ee5 c\u1ee7a b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh s\u1ebd c\u00f3 2 service c\u00f9ng v\u1edbi dapr nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23562 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-1.png\" alt=\"\" width=\"621\" height=\"101\" \/><\/p>\n<p>Service 2 s\u1ebd expose m\u1ed9t RESTful API v\u1edbi endpoint &#8220;\/hello&#8221;. Service 1 s\u1ebd call t\u1edbi endpoint &#8220;\/hello&#8221; n\u00e0y, nh\u01b0ng thay v\u00ec call tr\u1ef1c ti\u1ebfp th\u00ec n\u00f3 s\u1ebd call th\u00f4ng qua dapr \u0111\u00f3 c\u00e1c b\u1ea1n!<\/p>\n<p>N\u1ed9i dung c\u1ee7a HelloController trong Service 2 nh\u01b0 sau c\u00e1c b\u1ea1n nh\u00e9:<\/p>\n<pre class=\"lang:java decode:true \">package com.huongdanjava.dapr.serviceinvocation2;\r\n\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.GetMapping;\r\n\r\n@Controller\r\npublic class HelloController {\r\n\r\n  @GetMapping(\"\/hello\")\r\n  public String hello() {\r\n    return \"Hello from Huong Dan Java!\";\r\n  }\r\n\r\n}\r\n<\/pre>\n<p>Service 2 n\u00e0y s\u1ebd ch\u1ea1y tr\u00ean port 8081 b\u1eb1ng c\u00e1ch c\u1ea5u h\u00ecnh property server.port nh\u01b0 sau:<\/p>\n<pre class=\"lang:java decode:true \">server.port=8081<\/pre>\n<p>B\u00e2y gi\u1edd m\u00ecnh s\u1ebd vi\u1ebft code \u0111\u1ec3 Service 1 g\u1ecdi t\u1edbi Service 2 th\u00f4ng qua Dapr nh\u01b0 sau:<\/p>\n<pre class=\"lang:java decode:true \">package com.huongdanjava.dapr.serviceinvocation1;\r\n\r\nimport java.net.URI;\r\nimport java.net.http.HttpClient;\r\nimport java.net.http.HttpRequest;\r\nimport java.net.http.HttpResponse;\r\nimport java.time.Duration;\r\nimport org.springframework.boot.CommandLineRunner;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\n\r\n@SpringBootApplication\r\npublic class DaprServiceInvocation1Application implements CommandLineRunner {\r\n\r\n  @Override\r\n  public void run(String... args) throws Exception {\r\n    try (HttpClient httpClient = HttpClient.newBuilder()\r\n        .version(HttpClient.Version.HTTP_2)\r\n        .connectTimeout(Duration.ofSeconds(10))\r\n        .build()) {\r\n      String daprUrl = \"http:\/\/localhost:3500\/hello\";\r\n\r\n      HttpRequest request = HttpRequest.newBuilder()\r\n          .GET()\r\n          .uri(URI.create(daprUrl))\r\n          .header(\"Content-Type\", \"application\/json\")\r\n          .header(\"dapr-app-id\", \"service2\")\r\n          .build();\r\n\r\n      HttpResponse&lt;String&gt; response = httpClient.send(request,\r\n          HttpResponse.BodyHandlers.ofString());\r\n      System.out.println(\"Response: \" + response.body());\r\n    }\r\n  }\r\n\r\n  public static void main(String[] args) {\r\n    SpringApplication.run(DaprServiceInvocation1Application.class, args);\r\n  }\r\n\r\n}\r\n<\/pre>\n<p>Dapr c\u1ee7a m\u00ecnh s\u1ebd ch\u1ea1y \u1edf port 3500 n\u00ean nh\u01b0 c\u00e1c b\u1ea1n th\u1ea5y, m\u00ecnh \u0111ang s\u1eed d\u1ee5ng th\u01b0 vi\u1ec7n HttpClient c\u1ee7a Java \u0111\u1ec3 g\u1ecdi \u0111\u1ebfn endpoint &#8220;http:\/\/localhost:3500\/hello&#8221;.<\/p>\n<p>M\u1ed9t \u0111i\u1ec3m m\u00e0 c\u00e1c b\u1ea1n c\u1ea7n l\u01b0u \u00fd l\u00e0 ch\u00fang ta ph\u1ea3i ch\u1ec9 \u0111\u1ecbnh app id c\u1ee7a \u1ee9ng d\u1ee5ng m\u00e0 ch\u00fang ta c\u1ea7n g\u1ecdi t\u1edbi trong Dapr b\u1eb1ng c\u00e1ch truy\u1ec1n th\u00f4ng tin header &#8220;dapr-app-id&#8221;, nh\u01b0 m\u00ecnh l\u00e0m \u1edf tr\u00ean, khi g\u1ecdi t\u1edbi Dapr. Trong v\u00ed d\u1ee5 c\u1ee7a m\u00ecnh th\u00ec app id m\u00e0 m\u00ecnh mu\u1ed1n g\u1ecdi t\u1edbi l\u00e0 &#8220;service2&#8221;, khi \u0111\u00f3 Dapr s\u1ebd gi\u00fap Service 1 g\u1ecdi \u0111\u1ebfn Service 2 m\u00e0 kh\u00f4ng c\u1ea7n bi\u1ebft th\u00f4ng tin c\u1ee7a Service 2 nh\u01b0 th\u1ebf n\u00e0o!<\/p>\n<p>B\u00e2y gi\u1edd, \u0111\u1ec3 ch\u1ea1y c\u00e1c service n\u00e0y v\u1edbi Dapr, c\u00e1c b\u1ea1n h\u00e3y ch\u1ea1y Maven command<\/p>\n<pre class=\"lang:java decode:true \">mvn clean package -DskipTests<\/pre>\n<p>\u0111\u1ec3 build 2 \u1ee9ng d\u1ee5ng c\u1ee7a ch\u00fang ta tr\u01b0\u1edbc.<\/p>\n<p>Sau \u0111\u00f3, c\u00e1c b\u1ea1n h\u00e3y s\u1eed d\u1ee5ng Dapr CLI \u0111\u1ec3 ch\u1ea1y \u1ee9ng d\u1ee5ng c\u1ee7a ch\u00fang ta v\u1edbi Dapr.<\/p>\n<p>Ch\u00fang ta s\u1ebd ch\u1ea1y Service 2 v\u1edbi Dapr tr\u01b0\u1edbc, nh\u01b0 sau:<\/p>\n<pre class=\"lang:java decode:true \">dapr run --app-id service2 --app-port 8081 --app-protocol http --dapr-http-port 3501 -- java -jar target\/dapr-service-invocation-2-0.0.1-SNAPSHOT.jar<\/pre>\n<p>Khi ch\u1ea1y \u1ee9ng d\u1ee5ng v\u1edbi Dapr, ch\u00fang ta s\u1ebd \u0111\u1ecbnh ngh\u0129a Id cho t\u1eebng service s\u1eed d\u1ee5ng tham s\u1ed1 <strong>&#8211;app-id<\/strong> nh\u01b0 c\u00e1c b\u1ea1n th\u1ea5y \u1edf command tr\u00ean. Ch\u00fang ta s\u1ebd ph\u1ea3i \u0111\u1ecbnh ngh\u0129a port v\u00e0 protocol m\u00e0 ch\u00fang ta s\u1eed d\u1ee5ng \u0111\u1ec3 ch\u1ea1y \u1ee9ng d\u1ee5ng. Trong v\u00ed d\u1ee5 c\u1ee7a m\u00ecnh th\u00ec Service 2 s\u1ebd ch\u1ea1y \u1edf port 8081 v\u00e0 protocol l\u00e0 HTTP n\u00ean nh\u01b0 c\u00e1c b\u1ea1n th\u1ea5y, cho 2 tham s\u1ed1 <strong>&#8211;app-port<\/strong> v\u00e0 <strong>&#8211;app-protocol<\/strong> m\u00ecnh \u0111\u00e3 khai b\u00e1o c\u00e1c gi\u00e1 tr\u1ecb n\u00e0y.<\/p>\n<p>N\u1ebfu c\u00e1c b\u1ea1n ch\u1ea1y nhi\u1ec1u instance cho Service 2 th\u00ec gi\u00e1 tr\u1ecb c\u1ee7a tham s\u1ed1 &#8211;app-id s\u1ebd kh\u00f4ng \u0111\u1ed5i c\u00e1c b\u1ea1n nh\u00e9!<\/p>\n<p>Trong command c\u1ee7a m\u00ecnh \u1edf tr\u00ean, tham s\u1ed1 <strong>&#8211;dapr-http-port<\/strong> s\u1ebd \u0111\u1ecbnh ngh\u0129a port m\u00e0 Dapr s\u1ebd s\u1eed d\u1ee5ng \u0111\u1ec3 nh\u1eadn request t\u1eeb b\u00ean ngo\u00e0i.<\/p>\n<p>C\u00e1c b\u1ea1n h\u00e3y ch\u1ea1y command n\u00e0y trong th\u01b0 m\u1ee5c project c\u1ee7a Service 2 c\u00e1c b\u1ea1n nh\u00e9!<\/p>\n<p>K\u1ebft qu\u1ea3 c\u1ee7a m\u00ecnh nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23576 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-2.png\" alt=\"\" width=\"700\" height=\"638\" \/><\/p>\n<p>Cho Service 1, t\u01b0\u01a1ng t\u1ef1 nh\u01b0 Service 2, ch\u00fang ta c\u0169ng s\u1ebd s\u1eed d\u1ee5ng Dapr \u0111\u1ec3 ch\u1ea1y v\u1edbi Service 1. Trong th\u01b0 m\u1ee5c project c\u1ee7a Service 1, c\u00e1c b\u1ea1n h\u00e3y ch\u1ea1y command nh\u01b0 sau c\u00e1c b\u1ea1n nh\u00e9:<\/p>\n<pre class=\"lang:java decode:true \">dapr run --app-id service1 --dapr-http-port 3500 -- java -jar target\/dapr-service-invocation-1-0.0.1-SNAPSHOT.jar<\/pre>\n<p>C\u00e1c b\u1ea1n s\u1ebd th\u1ea5y k\u1ebft qu\u1ea3 nh\u01b0 sau:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23577 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-3.png\" alt=\"\" width=\"700\" height=\"622\" \/>Nh\u01b0 c\u00e1c b\u1ea1n th\u1ea5y, Service 1 c\u1ee7a m\u00ecnh c\u00f3 th\u1ec3 g\u1ecdi \u0111\u1ebfn Service 2 th\u00f4ng qua Dapr v\u00e0 nh\u1eadn v\u1ec1 response l\u00e0 &#8220;Hello from Huong Dan Java&#8221; \u0111\u00f3 c\u00e1c b\u1ea1n!<\/p>\n<p><strong>Behind the sense th\u00ec Dapr s\u1eed d\u1ee5ng API &#8220;invoke&#8221; \u0111\u00f3 c\u00e1c b\u1ea1n. <\/strong><\/p>\n<p>API <strong>invoke<\/strong> n\u00e0y s\u1ebd cho ph\u00e9p c\u00e1c \u1ee9ng d\u1ee5ng c\u00f3 th\u1ec3 g\u1ecdi v\u1edbi nhau th\u00f4ng qua app id. Ngo\u00e0i c\u00e1ch truy\u1ec1n th\u00f4ng tin app id tr\u00ean header c\u1ee7a request \u1edf v\u00ed d\u1ee5 tr\u00ean, c\u00e1c b\u1ea1n c\u00f2n c\u00f3 th\u1ec3 g\u1ecdi t\u1edbi Service 2 s\u1eed d\u1ee5ng c\u00fa ph\u00e1p:<\/p>\n<pre class=\"lang:java decode:true\">http:\/\/&lt;dapr_host&gt;:&lt;dapr_port&gt;\/v1.0\/invoke\/&lt;app_id&gt;\/method\/&lt;method_name&gt;\/&lt;parameter&gt;<\/pre>\n<p>V\u00ed d\u1ee5 c\u1ee7a m\u00ecnh nh\u01b0 sau:<\/p>\n<pre class=\"lang:java decode:true \">http:\/\/localhost:3501\/v1.0\/invoke\/service2\/method\/hello<\/pre>\n<p>K\u1ebft qu\u1ea3:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23578 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-4.png\" alt=\"\" width=\"700\" height=\"254\" \/><\/p>\n<p>M\u1ed9t c\u00e1ch kh\u00e1c, c\u00e1c b\u1ea1n c\u0169ng c\u00f3 th\u1ec3 truy\u1ec1n th\u00f4ng tin app id trong ph\u1ea7n Basic Authentication c\u1ee7a request, v\u00ed d\u1ee5 c\u1ee7a m\u00ecnh nh\u01b0 sau:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23580 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-5.png\" alt=\"\" width=\"700\" height=\"300\" \/><\/p>\n<p>Ho\u1eb7c s\u1eed d\u1ee5ng Dapr CLI c\u0169ng \u0111\u01b0\u1ee3c:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23581 aligncenter\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/service-invocation-voi-dapr-6.png\" alt=\"\" width=\"700\" height=\"45\" \/><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;23560&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Service Invocation v\u1edbi Dapr&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\"><\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Trong b\u00e0i vi\u1ebft tr\u01b0\u1edbc, m\u00ecnh \u0111\u00e3 h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch c\u00e0i \u0111\u1eb7t Dapr. \u0110\u1ec3 h\u00ecnh dung c\u00e1ch ho\u1ea1t \u0111\u1ed9ng c\u1ee7a Dapr nh\u01b0 th\u1ebf n\u00e0o, ch\u00fang ta h\u00e3y c\u00f9ng nhau l\u00e0m m\u1ed9t v\u00ed d\u1ee5 v\u1ec1 Service Invocation v\u1edbi Dapr c\u00e1c b\u1ea1n nh\u00e9! Dapr ho\u1ea1t \u0111\u1ed9ng&hellip; <a href=\"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":23502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2431],"tags":[],"class_list":["post-23560","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dapr","clearfix"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Service Invocation v\u1edbi Dapr - Huong Dan Java<\/title>\n<meta name=\"description\" content=\"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Service Invocation v\u1edbi Dapr - Huong Dan Java\" \/>\n<meta property=\"og:description\" content=\"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html\" \/>\n<meta property=\"og:site_name\" content=\"Huong Dan Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/nhkhanh2406\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/nhkhanh2406\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-27T15:07:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-27T22:36:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png\" \/>\n\t<meta property=\"og:image:width\" content=\"651\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Khanh Nguyen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/KhanhNguyenJ\" \/>\n<meta name=\"twitter:site\" content=\"@KhanhNguyenJ\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khanh Nguyen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html\"},\"author\":{\"name\":\"Khanh Nguyen\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"headline\":\"Service Invocation v\u1edbi Dapr\",\"datePublished\":\"2024-11-27T15:07:33+00:00\",\"dateModified\":\"2024-11-27T22:36:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html\"},\"wordCount\":862,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"image\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/dapr.png\",\"articleSection\":[\"Dapr\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html\",\"name\":\"Service Invocation v\u1edbi Dapr - Huong Dan Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/dapr.png\",\"datePublished\":\"2024-11-27T15:07:33+00:00\",\"dateModified\":\"2024-11-27T22:36:32+00:00\",\"description\":\"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#primaryimage\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/dapr.png\",\"contentUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/dapr.png\",\"width\":651,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/vi\\\/service-invocation-voi-dapr.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/huongdanjava.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Service Invocation v\u1edbi Dapr\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#website\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/\",\"name\":\"Huong Dan Java\",\"description\":\"Java development tutorials\",\"publisher\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/huongdanjava.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\",\"name\":\"Khanh Nguyen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"contentUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"width\":1267,\"height\":1517,\"caption\":\"Khanh Nguyen\"},\"logo\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\"},\"description\":\"I love Java and everything related to Java.\",\"sameAs\":[\"https:\\\/\\\/huongdanjava.com\",\"https:\\\/\\\/www.facebook.com\\\/nhkhanh2406\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/KhanhNguyenJ\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Service Invocation v\u1edbi Dapr - Huong Dan Java","description":"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.","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:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html","og_locale":"en_US","og_type":"article","og_title":"Service Invocation v\u1edbi Dapr - Huong Dan Java","og_description":"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.","og_url":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html","og_site_name":"Huong Dan Java","article_publisher":"https:\/\/www.facebook.com\/nhkhanh2406","article_author":"https:\/\/www.facebook.com\/nhkhanh2406","article_published_time":"2024-11-27T15:07:33+00:00","article_modified_time":"2024-11-27T22:36:32+00:00","og_image":[{"width":651,"height":400,"url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png","type":"image\/png"}],"author":"Khanh Nguyen","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/KhanhNguyenJ","twitter_site":"@KhanhNguyenJ","twitter_misc":{"Written by":"Khanh Nguyen","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#article","isPartOf":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html"},"author":{"name":"Khanh Nguyen","@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"headline":"Service Invocation v\u1edbi Dapr","datePublished":"2024-11-27T15:07:33+00:00","dateModified":"2024-11-27T22:36:32+00:00","mainEntityOfPage":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html"},"wordCount":862,"commentCount":0,"publisher":{"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"image":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#primaryimage"},"thumbnailUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png","articleSection":["Dapr"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html","url":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html","name":"Service Invocation v\u1edbi Dapr - Huong Dan Java","isPartOf":{"@id":"https:\/\/huongdanjava.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#primaryimage"},"image":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#primaryimage"},"thumbnailUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png","datePublished":"2024-11-27T15:07:33+00:00","dateModified":"2024-11-27T22:36:32+00:00","description":"Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch hi\u1ec7n th\u1ef1c Service Invocation v\u1edbi Dapr.","breadcrumb":{"@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#primaryimage","url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png","contentUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2024\/11\/dapr.png","width":651,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/huongdanjava.com\/vi\/service-invocation-voi-dapr.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/huongdanjava.com\/"},{"@type":"ListItem","position":2,"name":"Service Invocation v\u1edbi Dapr"}]},{"@type":"WebSite","@id":"https:\/\/huongdanjava.com\/#website","url":"https:\/\/huongdanjava.com\/","name":"Huong Dan Java","description":"Java development tutorials","publisher":{"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/huongdanjava.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d","name":"Khanh Nguyen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","contentUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","width":1267,"height":1517,"caption":"Khanh Nguyen"},"logo":{"@id":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg"},"description":"I love Java and everything related to Java.","sameAs":["https:\/\/huongdanjava.com","https:\/\/www.facebook.com\/nhkhanh2406","https:\/\/x.com\/https:\/\/twitter.com\/KhanhNguyenJ"]}]}},"_links":{"self":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/23560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/comments?post=23560"}],"version-history":[{"count":8,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/23560\/revisions"}],"predecessor-version":[{"id":23583,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/23560\/revisions\/23583"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/media\/23502"}],"wp:attachment":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/media?parent=23560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/categories?post=23560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/tags?post=23560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}