Broker Configuration
ActiveMQ Artemis is a high-performance messaging broker. This page provides an overview of how to configure the broker.xml
file, which is the primary configuration file for an Artemis broker.
broker.xml Overview
Section titled “broker.xml Overview”The broker.xml
file is located in the <broker-instance>/etc
directory. Its structure follows this general format:
<configuration xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- Basic Settings --> <name>{broker_name}</name> <persistence-enabled>{true|false}</persistence-enabled> <journal-type>{journal_type}</journal-type>
<!-- Connection Settings --> <acceptors> <acceptor name="{acceptor_name}">{transport_protocol}://{host}:{port}</acceptor> </acceptors>
<!-- Security Settings --> <security-settings> <security-setting match="{match_pattern}"> <permission type="{permission_type}" roles="{roles}" /> <permission type="{permission_type}" roles="{roles}" /> <permission type="{permission_type}" roles="{roles}" /> </security-setting> </security-settings>
<!-- Address Settings --> <address-settings> <address-setting match="{match_pattern}"> <dead-letter-address>{dead_letter_address}</dead-letter-address> <expiry-address>{expiry_address}</expiry-address> <redelivery-delay>{redelivery_delay}</redelivery-delay> <max-size-bytes>{max_size_bytes}</max-size-bytes> <page-size-bytes>{page_size_bytes}</page-size-bytes> </address-setting> </address-settings></configuration>
Configuration Elements
Section titled “Configuration Elements”Basic Settings
Section titled “Basic Settings”Defines the basic properties of the broker.
<name>
: Specifies the name of the broker.<persistence-enabled>
: Indicates whether message persistence is enabled.<journal-type>
: Specifies the type of journal used for message storage (e.g.,nio
,aio
).
Connection Settings
Section titled “Connection Settings”Defines how clients connect to the broker.
<acceptor>
: Specifies the transport protocol and address for client connections.name
: A unique identifier for the acceptor.- The address format is typically
tcp://host:port
orhttp://host:port
.
Security Settings
Section titled “Security Settings”Specifies security configurations for the broker.
<security-settings>
: Contains security settings for different roles and permissions.<permission_type>
: Defines permissions for specific actions (e.g.,send
,consume
,createNonDurableQueue
).roles
: Comma-separated list of roles that have the permission.
Address Settings
Section titled “Address Settings”Defines how messages are handled for specific addresses.
<address-setting>
: Configures behavior for addresses matching specific patterns.match
: A regex pattern to match addresses.dead-letter-address
: Specifies the address for undeliverable messages.expiry-address
: Specifies the address for expired messages.redelivery-delay
: Sets the delay before redelivering messages.max-size-bytes
: Maximum size of the address before paging.page-size-bytes
: Size of the page file for the address.
Example Configuration
Section titled “Example Configuration”Here is a sample configuration for a broker with custom settings:
<configuration xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <name>CustomBroker</name> <persistence-enabled>true</persistence-enabled> <journal-type>aio</journal-type>
<acceptors> <acceptor name="netty">tcp://0.0.0.0:61616</acceptor> <acceptor name="netty-secured">ssl://0.0.0.0:61617</acceptor> </acceptors>
<security-settings> <security-setting match="#"> <permission type="send" roles="admin,producer" /> <permission type="consume" roles="admin,consumer" /> <permission type="createNonDurableQueue" roles="admin,producer,consumer" /> </security-setting> </security-settings>
<address-settings> <address-setting match="#"> <dead-letter-address>DeadLetters</dead-letter-address> <expiry-address>ExpiredMessages</expiry-address> <redelivery-delay>3000</redelivery-delay> <max-size-bytes>5242880</max-size-bytes> <page-size-bytes>1048576</page-size-bytes> </address-setting> </address-settings></configuration>