Questo contenuto non è disponibile nella lingua selezionata.
Chapter 4. Using AMQ Management Console
AMQ Management Console is a web console included in the AMQ Broker installation that enables you to use a web browser to manage AMQ Broker.
AMQ Management Console is based on hawtio.
4.1. Overview Copia collegamentoCollegamento copiato negli appunti!
AMQ Broker is a full-featured, message-oriented middleware broker. It offers specialized queueing behaviors, message persistence, and manageability. It supports multiple protocols and client languages, freeing you to use many of your application assets.
AMQ Broker’s key features allow you to:
monitor your AMQ brokers and clients
- view the topology
- view network health at a glance
manage AMQ brokers using:
- AMQ Management Console
- Command-line Interface (CLI)
- Management API
The supported web browsers for AMQ Management Console are Firefox and Chrome. For more information on supported browser versions, see AMQ 7 Supported Configurations.
4.2. Configuring local and remote access to AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
The procedure in this section shows how to configure local and remote access to AMQ Management Console.
Remote access to the console can take one of two forms:
- Within a console session on a local broker, you use the Connect tab to connect to another, remote broker
- From a remote host, you connect to the console for the local broker, using an externally-reachable IP address for the local broker
Prerequisites
-
You must upgrade to at least AMQ Broker 7.1.0. As part of this upgrade, an access-management configuration file named
jolokia-access.xml
is added to the broker instance. For more information about upgrading, see Upgrading a Broker instance from 7.0.x to 7.1.0.
Procedure
-
Open the
<broker_instance_dir>/etc/bootstrap.xml
file. Within the
web
element, observe that the web port is bound only tolocalhost
by default.Copy to Clipboard Copied! Toggle word wrap Toggle overflow To enable connection to the console for the local broker from a remote host, change the web port binding to a network-reachable interface. For example:
<web path="web"> <binding uri="http://0.0.0.0:8161">
<web path="web"> <binding uri="http://0.0.0.0:8161">
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the preceding example, by specifying
0.0.0.0
, you bind the web port to all interfaces on the local broker.-
Save the
bootstrap.xml
file. -
Open the
<broker_instance_dir>/etc/jolokia-access.xml
file. Within the
<cors>
(that is, Cross-Origin Resource Sharing) element, add anallow-origin
entry for each HTTP origin request header that you want to allow to access the console. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the preceding configuration, you specify that the following connections are allowed:
Connection from the local host (that is, the host machine for your local broker instance) to the console.
-
The first asterisk (
*
) wildcard character allows either thehttp
orhttps
scheme to be specified in the connection request, based on whether you have configured the console for secure connections. - The second asterisk wildcard character allows any port on the host machine to be used for the connection.
-
The first asterisk (
-
Connection from a remote host to the console for the local broker, using the externally-reachable IP address of the local broker. In this case, the externally-reachable IP address of the local broker is
192.168.0.49
. -
Connection from within a console session opened on another, remote broker to the local broker. In this case, the IP address of the remote broker is
192.168.0.51
.
-
Save the
jolokia-access.xml
file. -
Open the
<broker_instance_dir>/etc/artemis.profile
file. To enable the Connect tab in the console, set the value of the
Dhawtio.disableProxy
argument tofalse
.-Dhawtio.disableProxy=false
-Dhawtio.disableProxy=false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIt is recommended that you enable remote connections from the console (that is, set the value of the
Dhawtio.disableProxy
argument tofalse
) only if the console is exposed to a secure network.Add a new argument,
Dhawtio.proxyWhitelist
, to theJAVA_ARGS
list of Java system arguments. As a comma-separated list, specify IP addresses for any remote brokers that you want to connect to from the local broker (that is, by using the Connect tab within a console session running on the local broker). For example:-Dhawtio.proxyWhitelist=192.168.0.51
-Dhawtio.proxyWhitelist=192.168.0.51
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Based on the preceding configuration, you can use the Connect tab within a console session on the local broker to connect to another, remote broker with an IP address of
192.168.0.51
.-
Save the
aretmis.profile
file.
Additional resources
- To learn how to access the console, see Section 4.3, “Accessing AMQ Management Console”.
For more information about:
- Cross-Origin Resource Sharing, see W3C Recommendations.
- Jolokia security, see Jolokia Protocols.
- Securing connections to the console, see Section 4.4.3, “Securing network access to AMQ Management Console”.
4.3. Accessing AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
The procedure in this section shows how to:
- Open AMQ Management Console from the local broker
- Connect to other brokers from within a console session on the local broker
- Open a console instance for the local broker from a remote host using the externally-reachable IP address of the local broker
Prerequisites
- You must have already configured local and remote access to the console. For more information, see Section 4.2, “Configuring local and remote access to AMQ Management Console”.
Procedure
In your web browser, navigate to the console address for the local broker.
The console address is
http://<host:port>/console/login
. If you are using the default address, navigate to http://localhost:8161/console/login. Otherwise, use the values of host and port that are defined for thebind
attribute of theweb
element in the<broker_instance_dir>/etc/bootstrap.xml
configuration file.- Log in to AMQ Management Console using the default user name and password that you created when you created the broker.
To connect to another, remote broker from the console session of the local broker:
- In the left menu, click the Connect tab.
- In the main pane, on the Remote tab, click the Add connection button.
In the Add Connection dialog box, specify the following details:
- Name
-
Name for the remote connection, for example,
my_other_broker
. - Scheme
-
Protocol to use for the remote connection. Select
http
for a non-secured connection, orhttps
for a secured connection. - Host
- IP address of a remote broker. You must have already configured console access for this remote broker.
- Port
-
Port on the local broker to use for the remote connection. Specify the port value that is defined for the
bind
attribute of theweb
element in the<broker_instance_dir>/etc/bootstrap.xml
configuration file. The default value is8161
. - Path
-
Path to use for console access. Specify
console/jolokia
.
To test the connection, click the Test Connection button.
If the connection test is successful, click the Add button. If the connection test fails, review and modify the connection details as needed. Test the connection again.
On the Remote page, for a connection that you have added, click the Connect button.
A new web browser tab opens for the console instance on the remote broker.
In the Log In dialog box, enter the user name and password for the remote broker. Click Log In.
The console instance for the remote broker opens.
To connect to the console for the local broker from a remote host, specify the Jolokia endpoint for the local broker in a web browser. This endpoint includes the externally-reachable IP address that you specified for the local broker when configuring remote console access. For example:
http://192.168.0.49/console/jolokia
http://192.168.0.49/console/jolokia
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.4. Configuring AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
Configure user access and request access to resources on the broker.
4.4.1. Securing AMQ Management Console using Red Hat Single Sign-On Copia collegamentoCollegamento copiato negli appunti!
Prerequisites
- Red Hat Single Sign-On 7.4
Procedure
Configure Red Hat Single Sign-On:
-
Navigate to the realm in Red Hat Single Sign-On that you want to use for securing AMQ Management Console. Each realm in Red Hat Single Sign-On includes a client named
Broker
. This client is not related to AMQ. -
Create a new client in Red Hat Single Sign-On, for example
artemis-console
. Navigate to the client settings page and set:
Valid Redirect URIs to the AMQ Management Console URL followed by
*
, for example:https://broker.example.com:8161/console/*
https://broker.example.com:8161/console/*
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Web Origins to the same value as Valid Redirect URIs. Red Hat Single Sign-On allows you enter
+
, indicating that allowed CORS origins includes the value for Valid Redirect URIs.
-
Create a role for the client, for example
guest
. - Make sure all users who require access to AMQ Management Console are assigned the above role, for example, using Red Hat Single Sign-On groups.
-
Navigate to the realm in Red Hat Single Sign-On that you want to use for securing AMQ Management Console. Each realm in Red Hat Single Sign-On includes a client named
Configure the AMQ Broker instance:
Add the following to your
<broker-instance-dir>/instances/broker0/etc/login.config
file to configure AMQ Management Console to use Red Hat Single Sign-On:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Adding this configuration sets up a JAAS principal and a requirement for a bearer token from Red Hat Single Sign-On. The connection to Red Hat Single Sign-On is defined in the
keycloak-bearer-token.json
file, as described in the next step.Create a file
<broker-instance-dir>/etc/keycloak-bearer-token.json
with the following contents to specify the connection to Red Hat Single Sign-On used for the bearer token exchange:Copy to Clipboard Copied! Toggle word wrap Toggle overflow <realm-name>
- the name of the realm in Red Hat Single Sign-On
<client-name>
- the name of the client in Red Hat Single Sign-On
<RHSSO-URL>
- the URL of Red Hat Single Sign-On
Create a file
<broker-instance-dir>/etc/keycloak-js-token.json
with the following contents to specify the Red Hat Single Sign-On authentication endpoint:{ "realm": "<realm-name>", "clientId": "<client-name>", "url": "<RHSSO-URL>/auth" }
{ "realm": "<realm-name>", "clientId": "<client-name>", "url": "<RHSSO-URL>/auth" }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the security settings by editing the the
<broker-instance-dir>/etc/broker.xml
file.For example, to allow users with the
amq
role consume messages and allow users with theguest
role send messages, add the following:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Run the AMQ Broker instance and validate AMQ Management Console configuration.
4.4.2. Setting up user access to AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
You can access AMQ Management Console using the broker login credentials. The following table provides information about different methods to add additional broker users to access AMQ Management Console:
Authentication Method | Description |
---|---|
Guest authentication | Enables anonymous access. In this configuration, any user who connects without credentials or with the wrong credentials will be authenticated automatically and assigned a specific user and role. For more information, see Configuring guest access in Configuring AMQ Broker. |
Basic user and password authentication | For each user, you must define a username and password and assign a security role. Users can only log into AMQ Management Console using these credentials. For more information, see Configuring basic user and password authentication in Configuring AMQ Broker. |
LDAP authentication | Users are authenticated and authorized by checking the credentials against user data stored in a central X.500 directory server. For more information, see Configuring LDAP to authenticate clients in Configuring AMQ Broker. |
4.4.3. Securing network access to AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
To secure AMQ Management Console when the console is being accessed over a WAN or the internet, use SSL to specify that network access uses https
instead of http
.
Prerequisites
The following should be located in the <broker_instance_dir>/etc/
directory:
- Java key store
- Java trust store (needed only if you require client authentication)
Procedure
-
Open the
<broker_instance_dir>/etc/bootstrap.xml
file. In the
<web>
element, add the following attributes:<web path="web"> <binding uri="https://0.0.0.0:8161" keyStorePath="<path_to_keystore>" keyStorePassword="<password>" clientAuth="<true/false>" trustStorePath="<path_to_truststore>" trustStorePassword="<password>"> </binding> </web>
<web path="web"> <binding uri="https://0.0.0.0:8161" keyStorePath="<path_to_keystore>" keyStorePassword="<password>" clientAuth="<true/false>" trustStorePath="<path_to_truststore>" trustStorePassword="<password>"> </binding> </web>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - bind
-
For secure connections to the console, change the URI scheme to
https
. - keyStorePath
Path of the keystore file. For example:
keyStorePath="<broker_instance_dir>/etc/keystore.jks"
keyStorePath="<broker_instance_dir>/etc/keystore.jks"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - keyStorePassword
- Key store password. This password can be encrypted.
- clientAuth
-
Specifies whether client authentication is required. The default value is
false
. - trustStorePath
-
Path of the trust store file. You need to define this attribute only if
clientAuth
is set totrue
. - trustStorePassword
- Trust store password. This password can be encrypted.
Additional resources
-
For more information about encrypting passwords in broker configuration files, including
bootstrap.xml
, see Encrypting Passwords in Configuration Files.
4.4.4. Configuring AMQ Management Console to use certificate-based authentication Copia collegamentoCollegamento copiato negli appunti!
You can configure AMQ Management Console to authenticate users by using certificates instead of passwords.
Procedure
Obtain certificates for the broker and clients from a trusted certificate authority or generate self-signed certificates. If you want to generate self-signed certificates, complete the following steps:
Generate a self-signed certificate for the broker.
keytool -storetype pkcs12 -keystore broker-keystore.p12 -storepass securepass -keypass securepass -alias client -genkey -keyalg "RSA" -keysize 2048 -dname "CN=ActiveMQ Broker, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -ext bc=ca:false -ext eku=cA
$ keytool -storetype pkcs12 -keystore broker-keystore.p12 -storepass securepass -keypass securepass -alias client -genkey -keyalg "RSA" -keysize 2048 -dname "CN=ActiveMQ Broker, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -ext bc=ca:false -ext eku=cA
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Export the certificate from the broker keystore, so that it can be shared with clients.
keytool -storetype pkcs12 -keystore broker-keystore.p12 -storepass securepass -alias client -exportcert -rfc > broker.crt
$ keytool -storetype pkcs12 -keystore broker-keystore.p12 -storepass securepass -alias client -exportcert -rfc > broker.crt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the client, import the broker certificate into the client truststore.
keytool -storetype pkcs12 -keystore client-truststore.p12 -storepass securepass -keypass securepass -importcert -alias client-ca -file broker.crt -noprompt
$ keytool -storetype pkcs12 -keystore client-truststore.p12 -storepass securepass -keypass securepass -importcert -alias client-ca -file broker.crt -noprompt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the client, generate a self-signed certificate for the client.
keytool -storetype pkcs12 -keystore client-keystore.p12 -storepass securepass -keypass securepass -alias client -genkey -keyalg "RSA" -keysize 2048 -dname "CN=ActiveMQ Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -ext bc=ca:false -ext eku=cA
$ keytool -storetype pkcs12 -keystore client-keystore.p12 -storepass securepass -keypass securepass -alias client -genkey -keyalg "RSA" -keysize 2048 -dname "CN=ActiveMQ Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -ext bc=ca:false -ext eku=cA
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Export the client certificate from the client keystore to a file so that it can be added to the broker truststore.
keytool -storetype pkcs12 -keystore client-keystore.p12 -storepass securepass -alias client -exportcert -rfc > client.crt
$ keytool -storetype pkcs12 -keystore client-keystore.p12 -storepass securepass -alias client -exportcert -rfc > client.crt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import the client certificate into the broker truststore.
keytool -storetype pkcs12 -keystore client-truststore.p12 -storepass securepass -keypass securepass -importcert -alias client-ca -file client.crt -noprompt
$ keytool -storetype pkcs12 -keystore client-truststore.p12 -storepass securepass -keypass securepass -importcert -alias client-ca -file client.crt -noprompt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOn the broker machine, ensure that the keystore and truststore files are in a location that is accessible to the broker.
In the
<broker_instance_dir>/etc/bootstrap.xml
file, update the web configuration to enable the HTTPS protocol and client authentication for the broker console. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow binding uri
- Specify the https protocol to enable SSL and add a host name and port.
keystorePath
- The path to the keystore where the broker certificate is installed.
keystorePassword
- The password of the keystore where the broker certificate is installed.
ClientAuth
- Set to true to configure the broker to require that each client presents a certificate when a client tries to connect to the broker console.
trustStorePath
- If clients are using self-signed certificates, specify the path to the truststore where client certificates are installed.
trustStorePassword
If clients are using self-signed certificates, specify the password of the truststore where client certificates are installed .
NOTE. You need to configure the
trustStorePath
andtrustStorePassword
properties only if clients are using self-signed certificates.
Obtain the Subject Distinguished Names (DNs) from each client certificate so you can create a mapping between each client certificate and a broker user.
Export each client certificate from the client’s keystore file into a temporary file. For example:
keytool -export -file <file_name> -alias broker-localhost -keystore broker.ks -storepass <password>
keytool -export -file <file_name> -alias broker-localhost -keystore broker.ks -storepass <password>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Print the contents of the exported certificate:
keytool -printcert -file <file_name>
keytool -printcert -file <file_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output is similar to that shown below:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
Owner
entry is the Subject DN. The format used to enter the Subject DN depends on your platform. The string above could also be represented as;Owner: `CN=localhost,\ OU=broker,\ O=Unknown,\ L=Unknown,\ ST=Unknown,\ C=Unknown`
Owner: `CN=localhost,\ OU=broker,\ O=Unknown,\ L=Unknown,\ ST=Unknown,\ C=Unknown`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Enable certificate-based authentication for the broker’s console.
Open the
<broker_instance_dir>/etc/login.config
configuration file. Add the certificate login module and reference the user and roles properties files. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow org.apache.activemq.artemis.spi.core.security.jaas.TextFileCertificateLoginModule
- The implementation class.
org.apache.activemq.jaas.textfiledn.user
- Specifies the location of the user properties file relative to the directory that contains the login configuration file.
org.apache.activemq.jaas.textfiledn.role
Specifies the properties file that maps users to defined roles for the login module implementation.
NoteIf you change the default name of the certificate login module configuration in the
<broker_instance_dir>/etc/login.config
file, you must update the value of the-dhawtio.realm
argument in the<broker_instance_dir>/etc/artemis.profile
file to match the new name. The default name isactivemq
.
Open the
<broker_instance_dir>/etc/artemis-users.properties
file. Create a mapping between client certificates and broker users by adding the Subject DNS that you obtained from each client certificate to a broker user. For example:user1=CN=user1,O=Progress,C=US user2=CN=user2,O=Progress,C=US
user1=CN=user1,O=Progress,C=US user2=CN=user2,O=Progress,C=US
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the user1 broker user is mapped to the client certificate that has a Subject Distinguished Name of CN=user1,O=Progress,C=US Subject DN. After you create a mapping between a client certificate and a broker user, the broker can authenticate the user by using the certificate.
Open the
<broker_instance_dir>/etc/artemis-roles.properties
file. Grant users permission to log in to the console by adding them to the role that is specified for the HAWTIO_ROLE variable in the<broker_instance_dir>/etc/artemis.profile
file. The default value of the HAWTIO_ROLE variable isamq
. For example:amq=user1, user2
amq=user1, user2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure the following recommended security properties for the HTTPS protocol.
-
Open the
<broker_instance_dir>/etc/artemis.profile
file. Set the
hawtio.http.strictTransportSecurity
property to allow only HTTPS requests to the AMQ Management Console and to convert any HTTP requests to HTTPS. For example:hawtio.http.strictTransportSecurity = max-age=31536000; includeSubDomains; preload
hawtio.http.strictTransportSecurity = max-age=31536000; includeSubDomains; preload
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
hawtio.http.publicKeyPins
property to instruct the web browser to associate a specific cryptographic public key with the AMQ Management Console to decrease the risk of “man-in-the-middle” attacks using forged certificates. For example:hawtio.http.publicKeyPins = pin-sha256="..."; max-age=5184000; includeSubDomains
hawtio.http.publicKeyPins = pin-sha256="..."; max-age=5184000; includeSubDomains
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Open the
4.4.5. Configuring AMQ Management Console to handle X-forwarded headers Copia collegamentoCollegamento copiato negli appunti!
If requests to AMQ Management Console are routed through a proxy server, you can configure the AMQ Broker embedded web server, which hosts AMQ Management Console, to handle X-Forwarded headers. By handling X-Forwarded headers, AMQ Management Console can receive header information that is otherwise altered or lost when a proxy is involved in the path of a request. For example, the proxy can expose AMQ Management Console using HTTPS, and the AMQ Management Console, which uses HTTP, can identify from the X-Forwarded header that the connection between the browser and the proxy uses HTTPS and switch to HTTPS to serve browser requests.
Procedure
-
Open the
<broker_instance_dir>/etc/bootstrap.xml
file. In the
<web>
element, add thecustomizer
attribute with a value oforg.eclipse.jetty.server.ForwardedRequestCustomizer
. For example:<web path="web" customizer="org.eclipse.jetty.server.ForwardedRequestCustomizer"> .. </web>
<web path="web" customizer="org.eclipse.jetty.server.ForwardedRequestCustomizer"> .. </web>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save the
bootstrap.xml
file. Start or restart the broker by entering the following command:
-
On Linux:
<broker_instance_dir>/bin/artemis run
-
On Windows:
<broker_instance_dir>\bin\artemis-service.exe start
-
On Linux:
4.5. Managing brokers using AMQ Management Console Copia collegamentoCollegamento copiato negli appunti!
You can use AMQ Management Console to view information about a running broker and manage the following resources:
- Incoming network connections (acceptors)
- Addresses
- Queues
4.5.1. Viewing details about the broker Copia collegamentoCollegamento copiato negli appunti!
To see how the broker is configured, in the left menu, click Artemis.
In the main pane, the following tabs are available:
Status
Displays information about the current status of the broker, such as version information, uptime and the high availability policy deployed. Also displays the amount of address memory that the broker is currently using. The graph shows this value as a proportion of the
global-max-size
configuration parameter.Figure 4.1. Status tab
Connections
- Displays information about broker connections, including client, cluster, and bridge connections.
Sessions
- Displays information about all sessions currently open on the broker.
Consumers
- Displays information about all consumers currently open on the broker.
Producers
- Displays information about producers currently open on the broker.
Addresses
- Displays information about addresses on the broker. This includes internal addresses, such as store-and-forward addresses.
Queues
- Displays information about queues on the broker. This includes internal queues, such as store-and-forward queues.
Broker diagram
- Displays a diagram of the cluster topology. This includes all brokers in the cluster and any addresses and queues on the local broker.
4.5.2. Viewing the broker diagram Copia collegamentoCollegamento copiato negli appunti!
You can view a diagram of all AMQ Broker resources in your topology, including brokers (live and backup brokers), producers and consumers, addresses, and queues.
Procedure
- In the left menu, click Artemis.
In the main pane, click the Broker Diagram tab.
The console displays a diagram of the cluster topology. This includes all brokers in the cluster and any addresses and queues on the local broker, as shown in the figure.
Figure 4.2. Broker diagram tab
- To change the items displayed in the diagram, in the Node options list, select the checkboxes for the items you want to display.
To show attributes for the local broker or an address or queue that is connected to it, click that node in the diagram. For example, the following figure shows a diagram that also includes attributes for the local broker.
Figure 4.3. Broker diagram tab, including attributes
4.5.3. Viewing acceptors Copia collegamentoCollegamento copiato negli appunti!
You can view details about the acceptors configured for the broker.
Procedure
- In the left menu, click Artemis JMX.
- In the folder tree, click acceptors.
To view details about how an acceptor is configured, click the acceptor.
The console shows the acceptor attributes on the Attributes tab and the operations you can execute for the acceptor on the Operations tab.
The following examples shows the attributes for the
amqp
acceptor.Figure 4.4. AMQP acceptor attributes
- To see complete details for an attribute, click the attribute. An additional pane opens to show the details.
- To execute an operation on the acceptor, click the Operations tab, expand the operation and click the Execute button.
4.5.4. Managing addresses and queues Copia collegamentoCollegamento copiato negli appunti!
An address represents a messaging endpoint. Within the configuration, a typical address is given a unique name.
A queue is associated with an address. There can be multiple queues per address. Once an incoming message is matched to an address, the message is sent on to one or more of its queues, depending on the routing type configured. Queues can be configured to be automatically created and deleted.
4.5.4.1. Creating addresses Copia collegamentoCollegamento copiato negli appunti!
A typical address is given a unique name, zero or more queues, and a routing type.
A routing type determines how messages are sent to the queues associated with an address. Addresses can be configured with two different routing types.
If you want your messages routed to… | Use this routing type… |
A single queue within the matching address, in a point-to-point manner. | Anycast |
Every queue within the matching address, in a publish-subscribe manner. | Multicast |
You can create and configure addresses and queues, and then delete them when they are no longer in use.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Addresses tab.
Click Create Address.
The Create Address dialog is displayed.
Figure 4.5. Create Address dialog
Complete the following fields:
Address Name
- The routing name of the address.
Routing type
Select one of the following options:
-
Multicast
: Messages sent to the address are distributed to all subscribers in a publish-subscribe manner. -
Anycast
: Messages sent to this address are distributed to only one subscriber in a point-to-point manner.
-
- Click Create Address.
4.5.4.2. Sending messages to an address Copia collegamentoCollegamento copiato negli appunti!
You can use the console to send messages to an address.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Addresses tab.
- Click the three-dot icon for the selected address.
Click Send Message.
The Send Message to Address <address name> dialog is displayed.
Figure 4.6. Send Message to Address
- By default messages are sent using the credentials that you used to log in to AMQ Management Console. If you want to use different credentials, clear the Use Current Logged in User checkbox and specify values in the Username and Password fields, which are displayed after you clear the checkbox.
- If necessary, click the Add Header button to add message header information.
- Enter the message body.
- In the Format drop-down menu, select an option for the format of the message body, and then click Format. The message body is formatted in a human-readable style for the format you selected.
Click Send.
The message is sent.
- To send additional messages, change any of the information you entered, and then click Send.
4.5.4.3. Creating queues Copia collegamentoCollegamento copiato negli appunti!
Queues provide a channel between a producer and a consumer.
Prerequisites
- The address to which you want to bind the queue must exist. To learn how to use the console to create an address, see Section 4.5.4.1, “Creating addresses”.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Addresses tab.
- Click the three-dot icon for the address to which you want to bind the queue.
Click Create Queue.
The Create Queue on Address <address name> dialog is displayed
Figure 4.7. Create Queue on Address dialog
Complete the following fields:
Queue name
- A unique name for the queue.
Routing Type
Select one of the following options:
-
Multicast
: Messages sent to the parent address will be distributed to all queues bound to the address. -
Anycast
: Only one queue bound to the parent address will receive a copy of the message. Messages will be distributed evenly among all of the queues bound to the address.
-
Durable
- If you select this option, the queue and its messages are persistent.
Filter
- The username to be used when connecting to the broker.
Max Consumers
- The maximum number of consumers that can access the queue at a given time.
Purge when no Consumers
- If selected, the queue will be purged when no consumers are connected.
- Click Create Queue.
4.5.4.4. Checking the status of a queue Copia collegamentoCollegamento copiato negli appunti!
Charts provide a real-time view of the status of a queue on a broker.
Procedure
- In the left menu, click Artemis JMX.
- In the folder tree, navigate to a queue.
Click the Chart tab.
The console displays a chart that shows real-time data for the queue attributes.
Figure 4.8. Chart tab for a queue
NoteTo view a chart for multiple queues on an address, select the
anycast
ormulticast
folder that contains the queues.By default, all attributes for a queue are displayed on the chart. If necessary, change the list of attributes displayed on the chart:
- Click Edit watches.
-
On the
Watched attributes
list, select the checkbox beside each attribute that you do not want to include in the chart. - Click the right arrow icon to remove the selected attributes from the chart.
- Click Close.
4.5.4.5. Browsing queues Copia collegamentoCollegamento copiato negli appunti!
Browsing a queue displays all of the messages in the queue. You can also filter and sort the list to find specific messages.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Queues tab.
- Click the three-dot icon for the queue that you want to browse.
Click Browse Messages.
The messages in the queue are displayed. By default, the first 200 messages are displayed.
Figure 4.9. Browse Queue dialog
To view the content of a message, click the three-dot icon for the message and click View.
You can view the message body, header and properties.
4.5.4.6. Sending messages to a queue Copia collegamentoCollegamento copiato negli appunti!
After creating a queue, you can send a message to it.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Queues tab.
- Click the three-dot icon for the queue to which you want to send a message .
Click Send Message.
The Send Message to Queue <queue name> dialog is displayed
Figure 4.10. Send Message to Queue dialog
- By default messages are sent using the credentials that you used to log in to AMQ Management Console. If you want to use different credentials, clear the Use Current Logged in User checkbox and specify values in the Username and Password fields, which are displayed after you clear the checkbox.
- If necessary, click the Add Header button to add message header information.
- Enter the message body.
- In the Format drop-down menu, select an option for the format of the message body, and then click Format. The message body is formatted in a human-readable style for the format you selected.
- Click Send.
- To send additional messages, change any of the information you entered, and then click Send.
4.5.4.7. Resending messages to a queue Copia collegamentoCollegamento copiato negli appunti!
You can resend previously sent messages.
Procedure
- Browse for the message you want to resend.
- Click the three-dot icon for the message that you want to resend.
Click Resend.
The Resend Message dialog is displayed.
- Update the message header and body as needed, and then click Send.
4.5.4.8. Moving messages to a different queue Copia collegamentoCollegamento copiato negli appunti!
You can move one or more messages in a queue to a different queue.
Procedure
- Browse for the messages you want to move.
- Click the checkbox next to each message that you want to move.
Click Move.
A confirmation dialog box is displayed.
- From the drop-down menu, select the name of the queue to which you want to move the messages. Click Confirm.
4.5.4.9. Deleting messages or queues Copia collegamentoCollegamento copiato negli appunti!
You can delete all of the messages in a queue and retain the queue, or you can delete the queue and any messages it contains.
Procedure
- In the left menu, click Artemis.
- In the main pane, click the Queues tab.
Click the three-dot icon for the queue you want to purge or delete.
- To delete all the message in the selected queue without deleting the queue, click Purge.
- To delete all the messages and the queue itself, click Delete.
- In the confirmation dialog, click Confirm.