blob: 6ea89deaa9c7fbacf8e72e4dcab4c11e3b1bec0a [file] [log] [blame]
== Camel Artemis Large Messages
=== Introduction
This example shows how to send large messages between Apache Camel and
ActiveMQ Artemis. For large messages we refer to messages with
sizes of GB.
You should be able to run Camel and Artemis in JVMs with lower memory
such as 256/512mb etc, and still be able to send messages in GB of sizes
between them.
This works by spool big messages to disk. Artemis spool large messages
to its `data/large-messages` directory, and Camel uses stream caching
to spool to a temporary directory during routing.
=== Build
The example is run using Maven.
First compile the example by entering:
[source,sh]
----
$ mvn compile
----
=== Install ActiveMQ Artemis
To automate downloading, unpacking and configuration of Apache ActiveMQ
Artemis with latest defined version a special profile is added. It's
necessary to run following Maven command for do this during example
install:
[source,sh]
----
$ mvn install -P artemis
----
=== Run ActiveMQ Artemis
To start configured ActiveMQ Artemis instance in a shell use:
[source,sh]
----
$ target/artemis-instance/bin/artemis run
----
Which startup ActiveMQ Artemis in the foreground and keeps it running
until you hit `ctrl+c` to shut down ActiveMQ Artemis.
=== Run Camel
Before running this example, then ensure the JVM has limited memory by
executing the following command in a new shell:
[source,sh]
----
$ export MAVEN_OPTS="-Xmx256m"
----
And then start the Camel application:
[source,sh]
----
$ mvn camel:run
----
You can then copy files to `target/inbox` folder which is sent to
Artemis, and then back again to Camel and written to the
`target/outbox` folder.
This should work for small and big files such as files with sizes of GB.
The JVM should not run out of memory.
To stop the example hit `ctrl+c`. If you restart it and resume entering
numbers you should see that it remembered previously entered values, as
it uses a persistent store.
=== ActiveMQ Artemis web console
You can browse the Artemis web console: http://localhost:8161/console to
see activity such as number of consumers and producers. You can also
delete all messages from queues which is a handy operation.
=== 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!