8000 rabbitmq-tutorials/scala at master · kobexffx/rabbitmq-tutorials · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"scala","repo":{"id":90832438,"defaultBranch":"master","name":"rabbitmq-tutorials","ownerLogin":"kobexffx","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2017-05-10T07:12:10.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/26061015?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1620743253.245562","canEdit":false,"refType":"branch","currentOid":"14a5e22b994d09748d53743a628e6bc454c7785f"},"tree":{"items":[{"name":"src/main/scala","path":"scala/src/main/scala","contentType":"directory","hasSimplifiedPath":true},{"name":"README.md","path":"scala/README.md","contentType":"file"},{"name":"pom.xml","path":"scala/pom.xml","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRabbitMQ Tutorials in Scala\u003c/h1\u003e\u003ca id=\"user-content-rabbitmq-tutorials-in-scala\" class=\"anchor\" aria-label=\"Permalink: RabbitMQ Tutorials in Scala\" href=\"#rabbitmq-tutorials-in-scala\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis is a minimalistic Scala port of the RabbitMQ tutorials in Java.\nThe port is admittedly quite close to Java in terms of code style.\nThis is primarily to the fact that RabbitMQ Java client still supports\nJDK 6 and doesn't have a lambda-friendly API.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCompiling the Code\u003c/h2\u003e\u003ca id=\"user-content-compiling-the-code\" class=\"anchor\" aria-label=\"Permalink: Compiling the Code\" href=\"#compiling-the-code\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn compile\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn compile\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRunning Examples\u003c/h2\u003e\u003ca id=\"user-content-running-examples\" class=\"anchor\" aria-label=\"Permalink: Running Examples\" href=\"#running-examples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHello World\u003c/h3\u003e\u003ca id=\"user-content-hello-world\" class=\"anchor\" aria-label=\"Permalink: Hello World\" href=\"#hello-world\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eExecute the following command to receive a hello world:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;Recv\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"Recv\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eExecute the following in a separate shell to send a hello world:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;Send\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"Send\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWork Queues\u003c/h3\u003e\u003ca id=\"user-content-work-queues\" class=\"anchor\" aria-label=\"Permalink: Work Queues\" href=\"#work-queues\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSend a message which will be finshed immediately:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;NewTask\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"NewTask\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSend a message which need some second to execute each . is one second.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;NewTask\u0026quot; -Dexec.args=\u0026quot;rabbit1 ....\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"NewTask\" -Dexec.args=\"rabbit1 ....\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo start a worker (run in a separate shell):\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;Worker\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"Worker\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAdd more workers to the same queue, message will be distributed in the\nround robin manner.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePublish and Subscriber\u003c/h3\u003e\u003ca id=\"user-content-publish-and-subscriber\" class=\"anchor\" aria-label=\"Permalink: Publish and Subscriber\" href=\"#publish-and-subscriber\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;EmitLog\u0026quot; -Dexec.args=\u0026quot;rabbit1 msg1\u0026quot;\n\nmvn exec:java -Dexec.mainClass=\u0026quot;ReceiveLogs\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"EmitLog\" -Dexec.args=\"rabbit1 msg1\"\n\nmvn exec:java -Dexec.mainClass=\"ReceiveLogs\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRPC\u003c/h3\u003e\u003ca id=\"user-content-rpc\" class=\"anchor\" aria-label=\"Permalink: RPC\" href=\"#rpc\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn one shell:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;RPCServer\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"RPCServer\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn another shell:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn exec:java -Dexec.mainClass=\u0026quot;RPCClient\u0026quot;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn exec:java -Dexec.mainClass=\"RPCClient\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"RabbitMQ Tutorials in Scala","anchor":"rabbitmq-tutorials-in-scala","htmlText":"RabbitMQ Tutorials in Scala"},{"level":2,"text":"Compiling the Code","anchor":"compiling-the-code","htmlText":"Compiling the Code"},{"level":2,"text":"Running Examples","anchor":"running-examples","htmlText":"Running Examples"},{"level":3,"text":"Hello World","anchor":"hello-world","htmlText":"Hello World"},{"level":3,"text":"Work Queues","anchor":"work-queues","htmlText":"Work Queues"},{"level":3,"text":"Publish and Subscriber","anchor":"publish-and-subscriber","htmlText":"Publish and Subscriber"},{"level":3,"text":"RPC","anchor":"rpc","htmlText":"RPC"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fkobexffx%2Frabbitmq-tutorials%2Ftree%2Fmaster%2Fscala"}},"totalCount":3,"showBranchInfobar":true},"fileTree":{"":{"items":[{"name":"bin","path":"bin","contentType":"directory"},{"name":"clojure","path":"clojure","contentType":"directory"},{"name":"common-lisp","path":"common-lisp","contentType":"directory"},{"name":"dotnet-visual-studio","path":"dotnet-visual-studio","contentType":"directory"},{"name":"dotnet","path":"dotnet","contentType":"directory"},{"name":"elixir","path":"elixir","contentType":"directory"},{"name":"erlang","path":"erlang","contentType":"directory"},{"name":"go","path":"go","contentType":"directory"},{"name":"haskell","path":"haskell","contentType":"directory"},{"name":"java-idea","path":"java-idea","contentType":"directory"},{"name":"java","path":"java","contentType":"directory"},{"name":"javascript-nodejs","path":"javascript-nodejs","contentType":"directory"},{"name":"objective-c","path":"objective-c","contentType":"directory"},{"name":"perl","path":"perl","contentType":"directory"},{"name":"php-amqp","path":"php-amqp","contentType":"directory"},{"name":"php","path":"php","contentType":"directory"},{"name":"python","path":"python","contentType":"directory"},{"name":"ruby","path":"ruby","contentType":"directory"},{"name":"scala","path":"scala","contentType":"directory"},{"name":"spring-amqp","path":"spring-amqp","contentType":"directory"},{"name":"swift","path":"swift","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"LICENSE.txt","path":"LICENSE.txt","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"test.py","path":"test.py","contentType":"file"},{"name":"travisci.py","path":"travisci.py","contentType":"file"}],"totalCount":28}},"fileTreeProcessingTime":2.208757,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/kobexffx/rabbitmq-tutorials/branches":{"post":"A062kbo4YqW7nEifFiZJEPHA_jYadt2PxSg9NCqMOP9XQywBilMQyjYMix0C5jTNaM3t6B7N5eexyXtiX7Pe1Q"},"/kobexffx/rabbitmq-tutorials/branches/fetch_and_merge/master":{"post":"22A0YU7_5WCgPk_8smwPcP0hhJw8cKhjTZHzqZBAmlojSyXnrxzN7LTq3rFlPQSrU-9hxPAg_XwBstBCcqDu_A"},"/kobexffx/rabbitmq-tutorials/branches/fetch_and_merge/master?discard_changes=true":{"post":"9PqDxOfbUJXdtlRczg6XCQrcm_5mZFPoJjtd1BVaBBoM0ZJCBjh4GclixREZX5zSpBJ-pqo0BvdqGH4_97pwvA"}}},"title":"rabbitmq-tutorials/scala at master · kobexffx/rabbitmq-tutorials","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0