activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bain <tb...@alumni.duke.edu>
Subject Re: Disconnect client on AMQ restart
Date Tue, 31 Jan 2017 14:00:03 GMT
Paul,

When you kill the broker, is it a hard kill (e.g. kill -9) or a graceful
shutdown?  If the former, is the behavior different if you do the latter?

Your config seems to indicate that you have three brokers; are all of them
in use here, or do you have only one up (so when it goes down temporarily,
the client cannot connect to any broker)?

Also, you may want to turn the client's logging level to DEBUG (at least
for org.apache.activemq) to see if that provides more information.

Tim

On Jan 30, 2017 10:19 AM, "Paul Mooney" <pc.mooney@gmail.com> wrote:

Hello Tim,

Thank you for the reply.
I am trying to get the appropriate logs to post.  I am basing my
understanding of what is happening by viewing in the AMQ web console.  What
I believe I see happening is that after AMQ restart, previous tcp
connection from a process is not disconnected.  Also a new connection has
been created by the process' reconnect strategy when AMQ is unavailable.

Until I determine how to provide the appropriate logs, here is what I
believe is happening.

process 'A' connects to AMQ - (C1)
AMQ restarts
process 'A' reconnects to AMQ - (R2)
AMQ console lists connections 'C' and 'R2'
AMQ restarts
process 'A' reconnects to AMQ - (R3)
AMQ console lists connections 'C1', 'R2', 'R3'

I will follow up with more detail.

Thank you for your time.


On Thu, Jan 19, 2017 at 2:28 PM, Paul Mooney <pc.mooney@gmail.com> wrote:

>
>
> Hello,
>
> I am using log4j2 JMSAppender to send logs to AMQ.
> When I restart either the client application or AMQ I see:
>
> JMSAppender connects as a new client connection.
> The previous connection is not disconnected.
>
> How can I make it so either the client connection is reused, or the
> previous client connection is disconnected?
>
> techonologies:
> AMQ 5.14.0
> log4j2
> mule esb
>
>
> Thank you for your time.
>
>
> Provided below:
> log4j2.xml configuration
> activemq.xml configuration
>
>
>
> log4j2.xml - jmsappender
> ******************
> <JMS name="jmsQueue"
> destinationBindingName="${sys:env}.logging"
> factoryName="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
> factoryBindingName="ConnectionFactory"
> providerURL="failover:(tcp://rh-esb-amq-pre-a.nx.com:60606,tcp://
> rh-esb-amq-pre-b.nx.com:60606,tcp://rh-esb-amq-pre-c.nx.com:60606
> )?randomize=false"
> userName="log"
> password="log">
>     <PatternLayout pattern='{"type":"middleware", "app":"${app_name}",
> "env":"${sys:env}", "date":"%d{ISO8601}", "thread":"[%t]",
> "loglevel":"%-5p", "message":"%c - %m"}'/>
> </JMS>
>
>
>
> ***********************
>
>
>
> activemq.xml
> transport connector used is: openwireLogging
> *********************
>
> <!--
>     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.
> -->
> <!-- START SNIPPET: example -->
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/
> schema/core/activemq-core.xsd">
>
>     <!-- Allows us to use system properties as variables in this
> configuration file -->
>     <bean class="org.springframework.beans.factory.config.
> PropertyPlaceholderConfigurer">
>         <property name="locations">
>             <value>file:${activemq.conf}/credentials.properties</value>
>         </property>
>     </bean>
>
>    <!-- Allows accessing the server log -->
>     <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
>           lazy-init="false" scope="singleton"
>           init-method="start" destroy-method="stop">
>     </bean>
>
>     <!--
>         The <broker> element is used to configure the ActiveMQ broker.
>     -->
>
>     <broker xmlns="http://activemq.apache.org/schema/core"  useJmx="true"
> brokerName="amq-pre" dataDirectory="${activemq.data}" start="false"
> schedulePeriodForDestinationPurge="10000" advisorySupport="false">
>
>         <destinationPolicy>
>             <policyMap>
>               <policyEntries>
>         <policyEntry queue=">" gcInactiveDestinations="true"
> inactiveTimoutBeforeGC="30000"/>
>                 <policyEntry topic=">" >
>                     <!-- The constantPendingMessageLimitStrategy is used
> to prevent
>                          slow topic consumers to block producers and
> affect other consumers
>                          by limiting the number of messages that are
> retained
>                          For more information, see:
>
>                          http://activemq.apache.org/
> slow-consumer-handling.html
>                     -->
>                   <pendingMessageLimitStrategy>
>                     <constantPendingMessageLimitStrategy limit="1000"/>
>           </pendingMessageLimitStrategy>
>                 </policyEntry>
>               </policyEntries>
>             </policyMap>
>         </destinationPolicy>
>
>     <!--  SSL TLS configuration
>     -->
>
>     <sslContext>
>       <sslContext keyStore="file:${activemq.conf}/pre-prod.jks"
> keyStorePassword="changeit" trustStore="file:${activemq.
conf}/pre-prod.jks"
> trustStorePassword="changeit" />
>       </sslContext>
>
>         <!--
>             The managementContext is used to configure how ActiveMQ is
> exposed in
>             JMX. By default, ActiveMQ uses the MBean server that is
> started by
>             the JVM. For more information, see:
>
>             http://activemq.apache.org/jmx.html
>         -->
>         <managementContext>
>             <managementContext createConnector="true" rmiServerPort="1098"
> connectorPort="1096"/>
>         </managementContext>
>
>       <!--
>         Configure user and group access to broker/queues
>     -->
>     <plugins>
>          <runtimeConfigurationPlugin checkPeriod="2000" />
>
>          <jaasAuthenticationPlugin configuration="activemq" />
>           <authorizationPlugin>
>             <map>
>               <authorizationMap>
>                 <authorizationEntries>
>                          <authorizationEntry queue=">" write="admins"
> read="admins" admin="admins" />
>                           <authorizationEntry topic=">" write="admins"
> read="admins" admin="admins" />
>                           <authorizationEntry topic="ActiveMQ.>"
> read="consumer,publisher,admins" write="consumer,publisher,admins"
> admin="consumer,publisher,admins" />
>                           <authorizationEntry queue="ActiveMQ.>"
> read="consumer,publisher,admins" write="consumer,publisher,admins"
> admin="consumer,publisher,admins"/>
>                           <authorizationEntry queue="test.email"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry
> queue="test.compliance.verify" read="consumer" write="publisher"
> admin="publisher,admins" />
>                           <authorizationEntry queue="test.batch"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="test.batch.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="test.poc"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="test.poc.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="test.hello"
> read="consumer" write="publisher" admin="publisher,admins" />
>                  <authorizationEntry queue="test.logging" read="consumer"
> write="publisher" admin="publisher,admins" />
>
>                  <authorizationEntry queue="stage.email" read="consumer"
> write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.compliance.
verify"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.batch"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.batch.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.poc"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.poc.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="stage.hello"
> read="consumer" write="publisher" admin="publisher,admins" />
>                  <authorizationEntry queue="stage.logging" read="consumer"
> write="publisher" admin="publisher,admins" />
>
>                  <authorizationEntry queue="train.email" read="consumer"
> write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="train.compliance.
verify"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="train.batch"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="train.batch.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="train.poc"
> read="consumer" write="publisher" admin="publisher,admins" />
>                           <authorizationEntry queue="train.poc.response"
> read="consumer" write="publisher" admin="publisher,admins" />
>                  <authorizationEntry queue="train.hello" read="consumer"
> write="publisher" admin="publisher,admins" />
>                  <authorizationEntry queue="train.logging" read="consumer"
> write="publisher" admin="publisher,admins" />
>
>                  <authorizationEntry topic="preprod.dktasks"
> read="consumer" write="publisher" admin="publisher,admins" />
>              </authorizationEntries>
>
>             <tempDestinationAuthorizationEntry>
>                         <tempDestinationAuthorizationEntry read="admins"
> write="admins" admin="admins"/>
>             </tempDestinationAuthorizationEntry>
>
>                   </authorizationMap>
>             </map>
>           </authorizationPlugin>
>     </plugins>
>
>         <!--
>             Configure message persistence for the broker. The default
> persistence
>             mechanism is the KahaDB store (identified by the kahaDB tag).
>             For more information, see:
>
>             http://activemq.apache.org/persistence.html
>         -->
>
>     <persistenceAdapter>
>             <replicatedLevelDB
>                 directory="${activemq.data}/leveldb-store"
>                 replicas="3"
>                 bind="tcp://0.0.0.0:61619"
>                 zkAddress="rh-esb-amq-pre-a.nx.com:2181,rh-esb-amq-pre-b.
> nx..com:2181,rh-esb-amq-pre-c.nx.com:2181/amq"
>                 zkPassword=""
>                 zkPath="/activemq/leveldb-store"
>                 hostname="rh-esb-amq-pre-a.nx..com"
>             />
>         </persistenceAdapter>
>
>         <networkConnectors>
>           <networkConnector
>         name="tcp-bridge"
>         staticBridge="true"
>         uri="masterslave:(tcp://rh-esb-amq-pre-a.nx.com:61616,
> tcp://rh-esb-amq-pre-a.nx..com:61616,tcp://rh-esb-amq-
> pre-a.nx..com:61616)"
>         duplex="true"
>         userName="admin"
>         password="amqAdmin"/>
>           <networkConnector
>         name="tcp-bridgeLogging"
>         staticBridge="true"
>         uri="masterslave:(tcp://rh-esb-amq-pre-a.nx.com:60606,
> tcp://rh-esb-amq-pre-a.nx..com:60606,tcp://rh-esb-amq-
> pre-a.nx..com:60606)"
>         duplex="true"
>         userName="admin"
>         password="amqAdmin"/>
>           <networkConnector
>         name="ssl-bridge"
>         staticBridge="true"
>         uri="masterslave:(ssl://rh-esb-amq-pre-a.nx.com:61643,ssl://
> rh-esb-amq-pre-a.nx.com:61643,ssl://rh-esb-amq-pre-a.nx.com:61643)"
>         userName="admin"
>         password="amqAdmin"/>
>           <networkConnector
>         name="amqp-bridge"
>         staticBridge="true"
>         uri="masterslave:(amqp://rh-esb-amq-pre-a.nx.com:5672,amqp://
> rh-esb-amq-pre-a.nx.com:5672,amqp://rh-esb-amq-pre-a.nx.com:5672)"
>         duplex="true"
>         userName="admin"
>         password="amqAdmin"/>
>         </networkConnectors>
>
>
>           <!--
>             The systemUsage controls the maximum amount of space the
> broker will
>             use before disabling caching and/or slowing down producers.
> For more information, see:
>             http://activemq.apache.org/producer-flow-control.html
>           -->
>           <systemUsage>
>             <systemUsage>
>                 <memoryUsage>
>                     <memoryUsage percentOfJvmHeap="70"/>
>                 </memoryUsage>
>                 <storeUsage>
>                     <storeUsage limit="5 gb"/>
>                 </storeUsage>
>                 <tempUsage>
>                     <tempUsage limit="1 gb"/>
>                 </tempUsage>
>             </systemUsage>
>         </systemUsage>
>
>         <!--
>             The transport connectors expose ActiveMQ over a given protocol
> to
>             clients and other brokers. For more information, see:
>
>             http://activemq.apache.org/configuring-transports.html
>
>         <transportConnector
>        name="amqp+ssl"
>        uri="amqp+ssl://0.0.0.0:5643?maximumConnections=1000&amp;
> wireFormat.maxFrameSize=104857600" />
>
>         -->
>         <transportConnectors>
>             <!-- DOS protection, limit concurrent connections to 1000 and
> frame size to 100MB -->
>          <transportConnector
>        name="openwire"
>        uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;
> wireFormat.maxFrameSize=104857600"/>
>       <transportConnector
>        name="openwireLogging"
>        uri="tcp://0.0.0.0:60606?maximumConnections=1000&amp;
> wireFormat.maxFrameSize=104857600"/>
>          <transportConnector
>        name="amqp"
>        uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;
> wireFormat.maxFrameSize=104857600"/>
>          <transportConnector
>        name="ssl" uri="ssl://0.0.0.0:61643?trace=true"/>
>
>         </transportConnectors>
>
>         <!-- destroy the spring context on shutdown to stop jetty -->
>         <shutdownHooks>
>             <bean xmlns="http://www.springframework.org/schema/beans"
> class="org.apache.activemq.hooks.SpringContextHook" />
>         </shutdownHooks>
>
>     </broker>
>
>     <!--
>         Enable web consoles, REST and Ajax APIs and demos
>         The web consoles requires by default login, you can disable this
> in the jetty.xml file
>
>         Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
>     -->
>     <import resource="jetty.xml"/>
>
> </beans>
> <!-- END SNIPPET: example -->
>
>


--
This e-mail is: [ ] public [x] private [ ] ask first

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message