Advertise with us

Search Mastertheboss

Our eBooks

Getting started with ActiveMQ Artemis

This tutorial will guide you through the installation and basic set up ofApache  ActiveMQ Artemis.

First off, download ActiveMQ Artemis from: https://activemq.apache.org/components/artemis/download/

Unzip the bundle, then move into the bin folder and create an instance of the broker:

 ./bin/artemis create myartemis --user admin --password admin --queues queueDemo --require-login

With this command, we have specified the credentials to login into the broker and a JMS Queue to be added into the configuration.

Let's try to start it:

myartemis/bin/artemis run
           __  __  ____    ____            _
     /\   |  \/  |/ __ \  |  _ \          | |
    /  \  | \  / | |  | | | |_) |_ __ ___ | | _____ _ __
   / /\ \ | |\/| | |  | | |  _ <| '__/ _ \| |/ / _ \ '__|
  / ____ \| |  | | |__| | | |_) | | | (_) |   <  __/ |
 /_/    \_\_|  |_|\___\_\ |____/|_|  \___/|_|\_\___|_|

 Red Hat AMQ 7.6.0.GA


2020-05-26 08:57:33,434 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2020-05-26 08:57:33,510 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2020-05-26 08:57:33,543 INFO  [org.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal
2020-05-26 08:57:33,598 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1,073,741,824
2020-05-26 08:57:33,633 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2020-05-26 08:57:33,634 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2020-05-26 08:57:33,634 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2020-05-26 08:57:33,635 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2020-05-26 08:57:33,635 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2020-05-26 08:57:33,636 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2020-05-26 08:57:33,722 INFO  [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2020-05-26 08:57:33,722 INFO  [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2020-05-26 08:57:33,813 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address DLQ supporting [ANYCAST]
2020-05-26 08:57:33,830 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2020-05-26 08:57:33,915 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-05-26 08:57:33,918 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-05-26 08:57:33,923 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address queueDemo supporting [ANYCAST]
2020-05-26 08:57:33,926 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue queueDemo on address queueDemo
2020-05-26 08:57:34,314 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2020-05-26 08:57:34,317 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2020-05-26 08:57:34,329 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2020-05-26 08:57:34,332 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2020-05-26 08:57:34,335 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2020-05-26 08:57:34,340 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2020-05-26 08:57:34,341 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.11.0.redhat-00005 [0.0.0.0, nodeID=2ca2bf72-9f1e-11ea-8287-fefdfc072182] 
2020-05-26 08:57:34,643 INFO  [io.hawt.branding.plugin.PluginContextListener] Initialized hawtio-redhat-fuse-branding plugin
2020-05-26 08:57:34,708 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2020-05-26 08:57:35,213 INFO  [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2020-05-26 08:57:35,214 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.4.0.redhat-630434 : http://hawt.io/ : Don't cha wish your console was hawt like me? ;-)
2020-05-26 08:57:35,215 INFO  [io.hawt.jmx.UploadManager] Using file upload directory: /home/francesco/tamcases/02655012/amq-broker-7.6.0/myartemis/tmp/uploads
2020-05-26 08:57:35,228 INFO  [io.hawt.web.AuthenticationFilter] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2020-05-26 08:57:35,256 INFO  [io.hawt.web.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/home/francesco/tamcases/02655012/amq-broker-7.6.0/myartemis/etc/jolokia-access.xml]
2020-05-26 08:57:35,278 INFO  [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based access control
2020-05-26 08:57:35,362 INFO  [io.hawt.system.ProxyWhitelist] Probing local addresses ...
2020-05-26 08:57:35,429 INFO  [io.hawt.system.ProxyWhitelist] Initial proxy whitelist: [localhost, 127.0.0.1, 192.168.130.1, 192.168.1.10, fedora.station]
2020-05-26 08:57:35,716 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2020-05-26 08:57:35,717 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2020-05-26 08:57:35,717 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console

Please notice, if you want to start ArtemisMQ in the background, you can use instead:

myartemis/bin/artemis run

Let's check that message exchange works correctly. We will be using the 'artemis' command to produce and consume messages:

 ./artemis consumer --destination demoQueue --user admin --password admin

Then, from another shell execute:

 ./artemis producer --destination demoQueue --user admin --password admin
Producer ActiveMQQueue[demoQueue], thread=0 Started to calculate elapsed time ...

Producer ActiveMQQueue[demoQueue], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[demoQueue], thread=0 Elapsed time in second : 3 s
Producer ActiveMQQueue[demoQueue], thread=0 Elapsed time in milli second : 3770 milli seconds

Back to the consumer window, you will see that messages have been consumed:

Consumer:: filter = null
Consumer ActiveMQQueue[demoQueue], thread=0 wait until 1000 messages are consumed
Received 1000
Consumer ActiveMQQueue[demoQueue], thread=0 Consumed: 1000 messages
Consumer ActiveMQQueue[demoQueue], thread=0 Elapsed time in second : 47 s
Consumer ActiveMQQueue[demoQueue], thread=0 Elapsed time in milli second : 47205 milli seconds
Consumer ActiveMQQueue[demoQueue], thread=0 Consumed: 1000 messages
Consumer ActiveMQQueue[demoQueue], thread=0 Consumer thread finished

Viewing the ActiveMQ Artemis Console

The ArtemisMQ console is available at http://localhost:8161/console, and you can login with admin/admin and browse the management console.

 artemismq tutorial

© 2020 mastertheboss.com. All Rights Reserved.

Please publish modules in offcanvas position.