Documentation

Clients

There are a few different ways that clients can connect to the broker. Java clients can:

Spring Boot

If Spring Boot detects Artemis on the classpath, it will automatically create a connection factory (see ArtemisXAConnectionFactoryConfiguration @ 1.5.19).

It will create this connection factory using some default parameters - i.e. localhost port 61616. These can be overridden by setting the following properties:

spring.artemis.mode=native
spring.artemis.host=192.168.1.210
spring.artemis.port=9876
spring.artemis.user=admin
spring.artemis.password=secret

Concepts

Queues and topics

Anycast vs multicast:

  • Anycast means a single queue within the matching address, in a point-to-point manner.
  • Multicast means every queue within the matching address, in a publish-subscribe manner.

  • The address setting auto-create-jms-queues configures whether the broker should automatically create a JMS queue when a JMS message is sent to a queue whose name fits the address.

Durability

  • A durable queue is a queue which is persisted.
  • Messages will survive a server crash or a restart, as long as the messages inside the queues are also durable.
  • Auto-created queues are non-durable.

Message grouping

Message grouping is where all messages for the same message group are sent to the same JMS consumer:

  • Useful when you need all messages with a certain grouping to be processed serially by the same consumer.
  • The JMS property name JMSXGroupID is used to identify a message group.
  • In a cluster, a grouping handler routes messages to the node where the correct consumer is connected.

Large messages

Large messages are handled differently by the broker:

  • Large messages do not count towards a queue size.
  • Even if address-full-policy=BLOCK, a producer will not be blocked from sending large messages. The messages will continue to arrive in the broker’s large messages directory (e.g. data/activemq/largemessages)
  • The threshold for what counts as a large message is set at connection factory level.

Connectivity

  • Connectors define the transport and parameters used to connect to the messaging server; e.g. in-vm connector, http connector
  • Acceptors identify the type of connections accepted by the messaging server; e.g. http acceptor

Bridges

  • A core bridge connects two instances of Artemis together.
  • A core bridge is also created implicitly when creating a cluster connection to another node.
  • A core bridge isn’t the same as a JMS bridge; and it doesn’t use the JMS API.
  • Core bridges use duplicate detection to guarantee once and only once delivery of messages across the bridge.

Clustering

  • When a node forms a cluster connection to another node, internally it creates a core bridge to that node.

High availability

Failover:

  • To properly test failover, you should kill the server abruptly, not gracefully, e.g.: kill -9 <JAVA_PID>

Relevant settings:

  • failover-on-shutdown=true - in a shared-storage topology, this causes failover to be triggered when a server is gracefully shut down
  • check-for-live-server=true -

Configuration

Creating queues and topics

  • In Java EE 7, a deployment descriptor can include configuration for queues and topics (<jms-destination>...</jms-destination>)

Configuration in EAP/Wildfly

See the EAP page on this site.

Destination settings

Address full policy (address-full-policy) can be set for a specific destination, or as a wildcard (#):

  • PAGE (default)
  • BLOCK
  • DROP

Logging

Artemis uses JBoss Logging as its logging framework (org.jboss.logmanager:jboss-logmanager) and is configured in logging.properties, e.g.:

# Additional logger names to configure (root logger is always configured)
# Root logger option
loggers=org.eclipse.jetty,org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms.server,org.apache.activemq.artemis.integration.bootstrap

# Root logger level
logger.level=INFO
# ActiveMQ Artemis logger levels
logger.org.apache.activemq.artemis.core.server.level=INFO
logger.org.apache.activemq.artemis.journal.level=INFO
logger.org.apache.activemq.artemis.utils.level=INFO
logger.org.apache.activemq.artemis.jms.level=INFO
logger.org.apache.activemq.artemis.integration.bootstrap.level=INFO
logger.org.eclipse.jetty.level=WARN
# Root logger handlers
logger.handlers=FILE,CONSOLE

# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=DEBUG
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN

# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.FILE.level=DEBUG
handler.FILE.properties=suffix,append,autoFlush,fileName
handler.FILE.suffix=.yyyy-MM-dd
handler.FILE.append=true
handler.FILE.autoFlush=true
handler.FILE.fileName=${artemis.instance}/log/artemis.log
handler.FILE.formatter=PATTERN

# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d %-5p [%c] %s%E%n

Performance

Potential factors to investigate to improve performance:

Messages being delivered to an address exceed its configured size:

  • In this instance, the queue will go into page mode.
  • Page mode is bad for performance, because messages have to be written to disk.
  • Once in page mode, a queue stays in that mode until it has been completely emptied.
  • Look at max-size-bytes to change the queue size in memory.
  • Alternatively, look at blocking producer flow control: set address-full-policy=BLOCK to block producers when max-size-bytes is reached.