You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/06/19 17:56:28 UTC

[camel-kamelets-examples] branch main updated: Add ActiveMQ Artemis example with connection pool

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 559ec5c  Add ActiveMQ Artemis example with connection pool
559ec5c is described below

commit 559ec5ce3b96e956cb3fec409703f96e038e24d2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 19 19:56:08 2023 +0200

    Add ActiveMQ Artemis example with connection pool
---
 jbang/artemis/README.adoc            | 75 ++++++++++++++++++++++++++++++++++++
 jbang/artemis/application.properties | 19 +++++++++
 jbang/artemis/consumer.yaml          |  7 ++++
 jbang/artemis/producer.yaml          | 12 ++++++
 4 files changed, 113 insertions(+)

diff --git a/jbang/artemis/README.adoc b/jbang/artemis/README.adoc
new file mode 100644
index 0000000..e13884b
--- /dev/null
+++ b/jbang/artemis/README.adoc
@@ -0,0 +1,75 @@
+== Apache ActiveMQ Artemis
+
+This example shows how to setup connection factory to a remote Apache ActiveMQ Artemis
+messaging broker.
+
+=== Apache ActiveMQ Artemis
+
+You first need to have an ActiveMQ Artimis broker up and running.
+See more at: https://activemq.apache.org/components/artemis/
+
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+----
+$ jbang --version
+----
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+----
+$ jbang app install camel@apache/camel
+----
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== How to run
+
+Then you can run this example using:
+
+[source,sh]
+----
+$ camel run *
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run *
+----
+
+=== Artemis configuration
+
+See the `application.properties` for how to configure to the ActiveMQ Artemis broker.
+
+
+=== Developer Web Console
+
+You can enable the developer console via `--console` flag as show:
+
+[source,sh]
+----
+$ camel run * --console
+----
+
+Then you can browse: http://localhost:8080/q/dev to introspect the running Camel applicaton.
+
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!
diff --git a/jbang/artemis/application.properties b/jbang/artemis/application.properties
new file mode 100644
index 0000000..3d9bb74
--- /dev/null
+++ b/jbang/artemis/application.properties
@@ -0,0 +1,19 @@
+# artemis connection factory
+camel.beans.artemisCF = #class:org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
+# URL for broker
+camel.beans.artemisCF.brokerURL = tcp://localhost:61616
+
+# if broker requires specific login
+#camel.beans.artemisCF.user = admin
+#camel.beans.artemisCF.password = admin
+
+# pooled connection factory
+camel.beans.poolCF = #class:org.messaginghub.pooled.jms.JmsPoolConnectionFactory
+camel.beans.poolCF.connectionFactory = #bean:artemisCF
+camel.beans.poolCF.maxSessionsPerConnection = 500
+camel.beans.poolCF.connectionIdleTimeout = 20000
+# more options can be configured
+# https://github.com/messaginghub/pooled-jms/blob/main/pooled-jms-docs/Configuration.md
+
+# setup JMS component to use connection factory
+camel.component.jms.connection-factory = #bean:poolCF
diff --git a/jbang/artemis/consumer.yaml b/jbang/artemis/consumer.yaml
new file mode 100644
index 0000000..bdb071e
--- /dev/null
+++ b/jbang/artemis/consumer.yaml
@@ -0,0 +1,7 @@
+# camel-k: language=yaml
+
+# Write your routes here, for example:
+- from:
+    uri: "jms:cheese"
+    steps:
+      - log: "${body}"
diff --git a/jbang/artemis/producer.yaml b/jbang/artemis/producer.yaml
new file mode 100644
index 0000000..7a5109e
--- /dev/null
+++ b/jbang/artemis/producer.yaml
@@ -0,0 +1,12 @@
+# camel-k: language=yaml
+
+# Write your routes here, for example:
+- route:
+    from:
+      uri: timer:tick
+      steps:
+        - setBody:
+            simple: ${random(100)}
+        - to:
+            uri: jms:cheese
+