Application to demostrate how to connect to artemis using spring-boot
See application.yml
mvn package
java -jar target/spring-amq-0.0.1-SNAPSHOT.jar
- Create AMQ Instances
<AMQ_BROKER_PATH>/bin/artemis create --user amq --password password --queues SpringAmqQueue --disable-persistence --allow-anonymous False AmqBroker
- Start instance
./AmqBroker/bin/artemis run
if you have this WARN
[org.apache.activemq.artemis.core.server] AMQ222210: Storage usage is beyond max-disk-usage. System will start blocking producers.
modify the property in ./AmqBroker/etc/broker.xml with value 100
- Send Message
curl http://localhost:8080/send\?text=maui
curl http://localhost:8080/sendMany\?text=maui\&many=1000
- Check Consumer
./AmqBroker/bin/artemis queue stat --user admin --password password --queueName SpringAmqQueue
- Create Oracle XE Docker Instance
Clone oracle github repository
cd docker-images/OracleDatabase/SingleInstance/dockerfiles
./buildContainerImage.sh -x -v 18.4.0
docker run --name OracleXE -p 1521:1521 -p 5500:5500 -e ORACLE_PWD=password oracle/database:18.4.0-xe
- Create Node1
<AMQ_BROKER_PATH>/bin/artemis create --user amq --password password --clustered --cluster-user cls_user --cluster-password cls_pwd --jdbc --jdbc-connection-url jdbc:oracle:thin:@localhost:1521/XE --jdbc-driver-class-name oracle.jdbc.driver.OracleDriver --staticCluster "tcp://localhost:62616" --relax-jolokia --no-autocreate --queues SpringAmqQueue --host localhost --require-login true --name node1 node1
curl https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/18.3.0.0/ojdbc8-18.3.0.0.jar -o node1/lib/ojdbc8-18.3.0.0.jar
edit node1/etc/broker.xml adding this xml fragment just after jdbc-connection-url node
<jdbc-user>system</jdbc-user>
<jdbc-password>password</jdbc-password>
edit node1/etc/broker.xml adding this xml fragment just after cluster-connections node
<ha-policy>
<shared-store>
<master>
<failover-on-shutdown>true</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
- Start instance
./node1/bin/artemis run
- Create Node2
<AMQ_BROKER_PATH>/bin/artemis create --user amq --password password --clustered --cluster-user cls_user --cluster-password cls_pwd --jdbc --jdbc-connection-url jdbc:oracle:thin:@localhost:1521/XE --jdbc-driver-class-name oracle.jdbc.driver.OracleDriver --staticCluster "tcp://localhost:61616" --relax-jolokia --port-offset 1000 --no-autocreate --queues SpringAmqQueue --host localhost --require-login true --name node2 node2
curl https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/18.3.0.0/ojdbc8-18.3.0.0.jar -o node2/lib/ojdbc8-18.3.0.0.jar
edit node2/etc/broker.xml adding this xml fragment just after jdbc-connection-url node
<jdbc-user>system</jdbc-user>
<jdbc-password>password</jdbc-password>
edit node2/etc/broker.xml adding this xml fragment just after cluster-connections node
<ha-policy>
<shared-store>
<slave>
<failover-on-shutdown>true</failover-on-shutdown>
<allow-failback>true</allow-failback>
<restart-backup>true</restart-backup>
</slave>
</shared-store>
</ha-policy>
- Start instance
./node2/bin/artemis run