{"id":9119,"date":"2023-01-12T14:58:40","date_gmt":"2023-01-12T06:58:40","guid":{"rendered":"http:\/\/123.57.164.21\/?p=9119"},"modified":"2023-01-12T14:58:40","modified_gmt":"2023-01-12T06:58:40","slug":"apache-camel-%e5%92%8cactive-mq%e7%9a%84tips","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=9119","title":{"rendered":"Apache Camel \u548cActive MQ\u7684Tips"},"content":{"rendered":"\n<p>Apache Camel \u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u548cActive MQ\u8fdb\u884c\u901a\u4fe1\uff0c\u4e0b\u9762\u662f\u4e00\u4e9bTips\u3002<\/p>\n\n\n\n<p><strong>1.Active MQ \u5b89\u88c5<\/strong><\/p>\n\n\n\n<p>Docker\u5b89\u88c5ActiveMQ<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#\u4e0b\u8f7d \u955c\u50cf\ndocker pull rmohr\/activemq\n\n#\u8fd0\u884c\u5bb9\u5668\ndocker run --name my-activemq -d -p 61616:61616 -p 8161:8161 rmohr\/activemq<\/pre>\n\n\n\n<p>\u8fd0\u884c\u6210\u529f\u4ee5\u540e\uff0c\u8bbf\u95ee <a rel=\"noreferrer noopener\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/192.168.1.5%3A8161\/admin\" target=\"_blank\">http:\/\/127.0.0.1:8161\/admin<\/a>\uff08\u7528\u6237\u540d\u548c\u5bc6\u7801\u9ed8\u8ba4\u4e3aadmin\uff09\uff0c\u5219\u542f\u52a8\u6210\u529f\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/01\/image-1024x442.png\" alt=\"\" class=\"wp-image-9122\" width=\"563\" height=\"242\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1024x442.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-300x129.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-768x331.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1536x662.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-2048x883.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-830x358.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-230x99.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-350x151.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-480x207.png 480w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/figure><\/div>\n\n\n\n<p><strong>2.Camel Maven\u5de5\u7a0b ActiveMQ Pom\u5bfc\u5165<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\n&lt;dependency>\n    &lt;groupId>org.apache.camel&lt;\/groupId>\n    &lt;artifactId>camel-activemq&lt;\/artifactId>\n    &lt;version>x.x.x&lt;\/version>\n    &lt;!-- use the same version as your Camel core version -->\n&lt;\/dependency>\n\n<\/pre>\n\n\n\n<p>\u4f46\u662f\u8fd0\u884c\u7684\u65f6\u5019\uff0c\u6709\u53ef\u80fd\u4f1a\u62a5\u4e0b\u9762\u7684\u9519\u8bef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">java.lang.ClassNotFoundException: javax.jms.JMSContext<\/pre>\n\n\n\n<p>\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e0b\u4f9d\u8d56\u89e3\u51b3\uff0cJMS 2.0 \u4f9d\u8d56\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    &lt;dependency>\n        &lt;groupId>javax.jms&lt;\/groupId>\n        &lt;artifactId>javax.jms-api&lt;\/artifactId>\n        &lt;version>2.0.1&lt;\/version>\n    &lt;\/dependency><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/01\/image-1.png\" alt=\"\" class=\"wp-image-9126\" width=\"469\" height=\"373\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1.png 980w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-300x239.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-768x611.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-830x661.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-230x183.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-350x279.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/01\/image-1-480x382.png 480w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/figure><\/div>\n\n\n\n<p><strong>3.Camel \u5de5\u7a0b\u4e2dSpring XML Sample<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?>\n&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\n       xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n       xsi:schemaLocation=\"\n        http:\/\/www.springframework.org\/schema\/beans http:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd\n        http:\/\/camel.apache.org\/schema\/spring http:\/\/camel.apache.org\/schema\/spring\/camel-spring.xsd\">\n        \n        &lt;bean id=\"activemq\" class=\"org.apache.camel.component.activemq.ActiveMQComponent\">\n \t\t\t&lt;property name=\"connectionFactory\">\n    \t\t\t&lt;bean class=\"org.apache.activemq.ActiveMQConnectionFactory\">\n      \t\t\t\t&lt;property name=\"brokerURL\" value=\"tcp:\/\/127.0.0.1:61616\"\/>\n   \t\t \t\t&lt;\/bean>\n  \t\t\t&lt;\/property>\n\t\t&lt;\/bean>\n\n    &lt;!-- \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u5b9a\u7fa9 -->\n    &lt;routeContext id=\"route-1\" xmlns=\"http:\/\/camel.apache.org\/schema\/spring\">\n        &lt;!-- \u30e1\u30a4\u30f3 -->\n        &lt;route id=\"mainroute-1\">\n        \t &lt;!-- \u4ecetestQueue\u53d7\u4fe1 -->\n             &lt;from uri=\"activemq:testQueue\"\/>\n             &lt;log loggingLevel=\"DEBUG\" message=\">>>${body}\"\/>\n             &lt;!-- \u5f80testQueue\u9001\u4fe1 -->\n             &lt;to uri=\"activemq:queue:testQueue\"\/>\n        &lt;\/route>\n    &lt;\/routeContext>\n&lt;\/beans>\n<\/pre>\n\n\n\n<p>\u6709\u7528\u7684\u7f51\u7ad9\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/camel.apache.org\/components\/next\/activemq-component.html#_producer_example\">https:\/\/camel.apache.org\/components\/next\/activemq-component.html<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/people.apache.org\/~dkulp\/camel\/activemq.html\">https:\/\/people.apache.org\/~dkulp\/camel\/activemq.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache Camel \u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u548cActive MQ\u8fdb\u884c\u901a\u4fe1\uff0c\u4e0b\u9762\u662f\u4e00\u4e9bTips\u3002 1.Active M [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9119"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9119"}],"version-history":[{"count":7,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9119\/revisions"}],"predecessor-version":[{"id":9128,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9119\/revisions\/9128"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}