第 2 章 Karaf 上的事务开始(OSGi)
本节介绍使用事务访问SOURCE JMS 代理的 Camel 应用程序。这些信息被组织如下:
2.1. 先决条件
此 Camel 应用程序的实施有以下先决条件:
必须运行一个外部 AMQ 7 JMS 消息代理。
以下示例代码运行
amq-broker-7.1.0-bin.zip
的独立(非 Docker)版本。执行将创建并运行amq7
实例:$ pwd /data/servers/amq-broker-7.1.0 $ bin/artemis create --user admin --password admin --require-login amq7 Creating ActiveMQ Artemis instance at: /data/servers/amq-broker-7.1.0/amq7 Auto tuning journal ... done! Your system can make 27.78 writes per millisecond, your journal-buffer-timeout will be 36000 You can now start the broker by executing: "/data/servers/amq-broker-7.1.0/amq7/bin/artemis" run Or you can run the broker in the background using: "/data/servers/amq-broker-7.1.0/amq7/bin/artemis-service" start $ amq7/bin/artemis run __ __ ____ ____ _ /\ | \/ |/ __ \ | _ \ | | / \ | \ / | | | | | |_) |_ __ ___ | | _____ _ __ / /\ \ | |\/| | | | | | _ <| '__/ _ \| |/ / _ \ '__| / ____ \| | | | |__| | | |_) | | | (_) | < __/ | /_/ \_\_| |_|\___\_\ |____/|_| \___/|_|\_\___|_| Red Hat JBoss AMQ 7.1.0.GA 018-05-02 16:37:19,294 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server ...
需要客户端库。Django 库可用于 Maven Central 或红帽存储库。例如,您可以使用:
-
mvn:org.apache.activemq/artemis-core-client/2.4.0.amq-710008-redhat-1
-
mvn:org.apache.activemq/artemis-jms-client/2.4.0.amq-710008-redhat-1
或者,Fuhad/AMQ 7 客户端库可以安装为 Karaf 功能,例如:
-
Karaf@root()> feature:install artemis-jms-client artemis-core-client
-
需要一些支持功能,它们提供 Karaf shell 命令或专用语支持:
karaf@root()> feature:install jms pax-jms-artemis pax-jms-config
所需的 Camel 功能包括:
karaf@root()> feature:install camel-jms camel-blueprint