如何解决为什么消息不会在Apache Artemis中进入队列?
我已经使用Artemis队列工作了几天,并配置了2个代理以使用共享存储作为实时和备份运行(但问题可能与之无关,因为我只运行实时服务器)。直到今天早上一切都很好。在使用控制台删除队列中的所有消息并尝试将消息再次发送到队列之后,不再创建队列,也没有将消息添加到队列中。但是我也没有得到任何错误或异常。请注意,我之前曾经尝试过相同的方法,那些时候正确创建了队列,并且消息也被添加了。 非常感谢有人能帮助我弄清楚问题出在哪里。
到目前为止我尝试过的事情:
- 使用控制台手动创建队列。 (仍然没有添加消息)
- 已启用代理中的日志(以下是日志)
这是我的消息产生者代码
public void send(final Event event) throws JsonProcessingException,JMSException {
Connection connection = null;
Session session = null;
MessageProducer producer = null;
try {
connection = this.poolingFactory.createConnection();
connection.start();
session = connection.createSession();
producer = session.createProducer(destination);
String asString = objectMapper.writeValueAsString(event);
TextMessage textMessage = session.createTextMessage(asString);
producer.send(textMessage);
} finally {
cleanUpResources(producer,session,connection);
}
}
这是我的broker.xml文件
<?xml version='1.0'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License,Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,software distributed under the License is distributed on an
"AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND,either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<name>0.0.0.0</name>
<persistence-enabled>true</persistence-enabled>
<!-- this could be ASYNCIO,MAPPED,NIO
ASYNCIO: Linux Libaio
MAPPED: mmap files
NIO: Plain Java Files
-->
<journal-type>ASYNCIO</journal-type>
<paging-directory>/home/thumula/artemisSharedStorage/data/paging</paging-directory>
<bindings-directory>/home/thumula/artemisSharedStorage/data/bindings</bindings-directory>
<journal-directory>/home/thumula/artemisSharedStorage/data/journal</journal-directory>
<large-messages-directory>/home/thumula/artemisSharedStorage/data/large-messages</large-messages-directory>
<journal-datasync>true</journal-datasync>
<journal-min-files>2</journal-min-files>
<journal-pool-files>10</journal-pool-files>
<journal-device-block-size>4096</journal-device-block-size>
<journal-file-size>10M</journal-file-size>
<!--
This value was determined through a calculation.
Your system could perform 11.9 writes per millisecond
on the current journal configuration.
That translates as a sync write every 84000 nanoseconds.
Note: If you specify 0 the system will perform writes directly to the disk.
We recommend this to be 0 if you are using journalType=MAPPED and journal-datasync=false.
-->
<journal-buffer-timeout>84000</journal-buffer-timeout>
<!--
When using ASYNCIO,this will determine the writing queue depth for libaio.
-->
<journal-max-io>4096</journal-max-io>
<!--
You can verify the network health of a particular NIC by specifying the <network-check-NIC> element.
<network-check-NIC>theNicName</network-check-NIC>
-->
<!--
Use this to use an HTTP server to validate the network
<network-check-URL-list>http://www.apache.org</network-check-URL-list> -->
<!-- <network-check-period>10000</network-check-period> -->
<!-- <network-check-timeout>1000</network-check-timeout> -->
<!-- this is a comma separated list,no spaces,just DNS or IPs
it should accept IPV6
Warning: Make sure you understand your network topology as this is meant to validate if your network is valid.
Using IPs that could eventually disappear or be partially visible may defeat the purpose.
You can use a list of multiple IPs,and if any successful ping will make the server OK to continue running -->
<!-- <network-check-list>10.0.0.1</network-check-list> -->
<!-- use this to customize the ping used for ipv4 addresses -->
<!-- <network-check-ping-command>ping -c 1 -t %d %s</network-check-ping-command> -->
<!-- use this to customize the ping used for ipv6 addresses -->
<!-- <network-check-ping6-command>ping6 -c 1 %2$s</network-check-ping6-command> -->
<!-- how often we are looking for how many bytes are being used on the disk in ms -->
<disk-scan-period>5000</disk-scan-period>
<!-- once the disk hits this limit the system will block,or close the connection in certain protocols
that won't support flow control. -->
<max-disk-usage>90</max-disk-usage>
<!-- should the broker detect dead locks and other issues -->
<critical-analyzer>true</critical-analyzer>
<critical-analyzer-timeout>120000</critical-analyzer-timeout>
<critical-analyzer-check-period>60000</critical-analyzer-check-period>
<critical-analyzer-policy>HALT</critical-analyzer-policy>
<page-sync-timeout>4892000</page-sync-timeout>
<!-- the system will enter into page mode once you hit this limit.
This is an estimate in bytes of how much the messages are using in memory
The system will use half of the available memory (-Xmx) by default for the global-max-size.
You may specify a different value here if you need to customize it to your needs.
<global-max-size>100Mb</global-max-size>
-->
<acceptors>
<!-- useEpoll means: it will use Netty epoll if you are on a system (Linux) that supports it -->
<!-- amqpCredits: The number of credits sent to AMQP producers -->
<!-- amqpLowCredits: The server will send the # credits specified at amqpCredits at this low mark -->
<!-- amqpDuplicateDetection: If you are not using duplicate detection,set this to false
as duplicate detection requires applicationProperties to be parsed on the server. -->
<!-- amqpMinLargeMessageSize: Determines how many bytes are considered large,so we start using files to hold their data.
default: 102400,-1 would mean to disable large mesasge control -->
<!-- Note: If an acceptor needs to be compatible with HornetQ and/or Artemis 1.x clients add
"anycastPrefix=jms.queue.;multicastPrefix=jms.topic." to the acceptor url.
See https://issues.apache.org/jira/browse/ARTEMIS-1644 for more information. -->
<!-- Acceptor for every supported protocol -->
<acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor>
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true</acceptor>
<!-- STOMP Acceptor. -->
<acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true</acceptor>
<!-- HornetQ Compatibility Acceptor. Enables HornetQ Core and STOMP for legacy HornetQ clients. -->
<acceptor name="hornetq">tcp://0.0.0.0:5445?anycastPrefix=jms.queue.;multicastPrefix=jms.topic.;protocols=HORNETQ,STOMP;useEpoll=true</acceptor>
<!-- MQTT Acceptor -->
<acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
</acceptors>
<connectors>
<connector name="netty">tcp://0.0.0.0:61616</connector>
<connector name="slave-broker-connector">tcp://0.0.0.0:61617</connector>
</connectors>
<ha-policy>
<shared-store>
<master>
<failover-on-shutdown>true</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>netty</connector-ref>
<static-connectors>
<connector-ref>slave-broker-connector</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq"/>
<permission type="deleteNonDurableQueue" roles="amq"/>
<permission type="createDurableQueue" roles="amq"/>
<permission type="deleteDurableQueue" roles="amq"/>
<permission type="createAddress" roles="amq"/>
<permission type="deleteAddress" roles="amq"/>
<permission type="consume" roles="amq"/>
<permission type="browse" roles="amq"/>
<permission type="send" roles="amq"/>
<!-- we need this otherwise ./artemis data imp wouldn't work -->
<permission type="manage" roles="amq"/>
</security-setting>
</security-settings>
<address-settings>
<!-- if you define auto-create on certain queues,management has to be auto-create -->
<address-setting match="activemq.management#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>-1</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>-1</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>
</address-settings>
<addresses>
<address name="DLQ">
<anycast>
<queue name="DLQ" />
</anycast>
</address>
<address name="ExpiryQueue">
<anycast>
<queue name="ExpiryQueue" />
</anycast>
</address>
</addresses>
<!-- Uncomment the following if you want to use the Standard LoggingActiveMQServerPlugin pluging to log in events
-->
<broker-plugins>
<broker-plugin class-name="org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin">
<property key="LOG_ALL_EVENTS" value="true"/>
<property key="LOG_CONNECTION_EVENTS" value="true"/>
<property key="LOG_SESSION_EVENTS" value="true"/>
<property key="LOG_CONSUMER_EVENTS" value="true"/>
<property key="LOG_DELIVERING_EVENTS" value="true"/>
<property key="LOG_SENDING_EVENTS" value="true"/>
<property key="LOG_INTERNAL_EVENTS" value="true"/>
</broker-plugin>
</broker-plugins>
</core>
</configuration>
这是日志文件
2020-10-27 12:01:07,338 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2020-10-27 12:01:07,545 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=true,journalDirectory=/home/thumula/artemisSharedStorage/data/journal,bindingsDirectory=/home/thumula/artemisSharedStorage/data/bindings,largeMessagesDirectory=/home/thumula/artemisSharedStorage/data/large-messages,pagingDirectory=/home/thumula/artemisSharedStorage/data/paging)
2020-10-27 12:01:07,548 INFO [org.apache.activemq.artemis.core.server] AMQ221006: Waiting to obtain live lock
2020-10-27 12:01:07,689 INFO [org.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal
2020-10-27 12:01:07,896 WARN [org.apache.activemq.artemis.core.server] AMQ222007: Security risk! Apache ActiveMQ Artemis is running with the default cluster admin user and default password. Please see the cluster chapter in the ActiveMQ Artemis User Guide for instructions on how to change this.
2020-10-27 12:01:07,923 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-10-27 12:01:08,236 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2020-10-27 12:01:08,238 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2020-10-27 12:01:08,238 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2020-10-27 12:01:08,239 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2020-10-27 12:01:08,240 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2020-10-27 12:01:08,274 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2020-10-27 12:01:08,823 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2020-10-27 12:01:08,824 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2020-10-27 12:01:13,593 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address DLQ supporting [ANYCAST]
2020-10-27 12:01:13,596 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2020-10-27 12:01:13,635 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-10-27 12:01:13,636 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-10-27 12:01:14,428 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols [CORE,OPENWIRE]
2020-10-27 12:01:14,450 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2020-10-27 12:01:14,484 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2020-10-27 12:01:14,510 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2020-10-27 12:01:14,574 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2020-10-27 12:01:14,588 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2020-10-27 12:01:14,589 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.15.0 [0.0.0.0,nodeID=6a36e685-12b7-11eb-b699-08002776fb65]
2020-10-27 12:01:15,688 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2020-10-27 12:01:15,982 INFO [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2020-10-27 12:01:17,522 INFO [io.hawt.HawtioContextListener] Initialising hawtio services
2020-10-27 12:01:17,712 INFO [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2020-10-27 12:01:17,715 INFO [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt like me? ;-)
2020-10-27 12:01:17,731 INFO [io.hawt.jmx.UploadManager] Using file upload directory: /home/thumula/artemisSharedStorage/masterBroker/tmp/uploads
2020-10-27 12:01:17,817 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-10-27 12:01:17,945 INFO [io.hawt.web.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation,value=file:/home/thumula/artemisSharedStorage/masterBroker/etc/jolokia-access.xml]
2020-10-27 12:01:18,087 INFO [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based access control
2020-10-27 12:01:18,625 INFO [io.hawt.system.ProxyWhitelist] Initial proxy whitelist: [localhost,127.0.0.1,10.0.2.15]
2020-10-27 12:01:19,700 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2020-10-27 12:01:19,702 INFO [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2020-10-27 12:01:19,702 INFO [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console
2020-10-27 12:02:36,990 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841000: created connection: RemotingConnectionImpl [ID=ae2a1491,clientID=null,nodeID=6a36e685-12b7-11eb-b699-08002776fb65,transportConnection=org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection@2ffee1c2[ID=ae2a1491,local= /127.0.0.1:61616,remote=/127.0.0.1:35748]]
2020-10-27 12:02:37,398 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841010: routed message with ID: 214666,result: NO_BINDINGS
2020-10-27 12:02:37,399 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841002: created session name: 3464d1fc-181e-11eb-ba86-08002776fb65,session connectionID: ae2a1491
2020-10-27 12:02:37,431 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841004: added session metadata for session name : 3464d1fc-181e-11eb-ba86-08002776fb65,key: jms-session,data:
2020-10-27 12:02:37,441 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841010: routed message with ID: 214668,442 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841002: created session name: 3488adad-181e-11eb-ba86-08002776fb65,445 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841004: added session metadata for session name : 3488adad-181e-11eb-ba86-08002776fb65,487 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841010: routed message with ID: 214669,502 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841009: sent message with ID: 214669,session name: 3488adad-181e-11eb-ba86-08002776fb65,session connectionID: ae2a1491,689 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841010: routed message with ID: 214670,689 INFO [org.apache.activemq.artemis.core.server.plugin.impl] AMQ841009: sent message with ID: 214670,result: NO_BINDINGS
2020-10-27 12:02:50,862 INFO [io.hawt.web.LoginServlet] hawtio login is using 1800 sec. HttpSession timeout
再次,非常感谢您对此提供的帮助:)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。