Ping to tickle the forum.

Bueller?  ... Bueller?


I made an interesting observation over the weekend that may help explain
what's going on here, but need some assistance.  

I've modified my spring configuration to use a PooledConnectionFactory.  I'm
using ActiveMQ 4.1.1 and the 1.1 JMS APIs (Hence JMSTemplate replacing
JMSTemplate102).   Here's the new spring conf:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd";>
<beans>
    <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
   
   
  <bean id="jmsTopicConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
    <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL">
            <value>peer://mybrokergroup/mybrokername</value>
        </property>
      </bean>
    </property>
  </bean>

    <bean id="TestTopic" class="org.apache.activemq.command.ActiveMQTopic"> 
        <constructor-arg>
            <value>TestTopic</value>
        </constructor-arg>      
    </bean>
    
    <bean id="SenderBean" class="com.ssi.exp.TestMessageSender">                
        
        <property name="jmsTemplate">
            <ref bean="TestTopicJmsTemplate"/>
        </property>
    </bean>             
    
    <bean id="MessageListener" class="com.ssi.exp.TestMessageListener" />
    
    <bean id="TestJmsTopicListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="concurrentConsumers">
            <value>1</value>
        </property>
        <property name="connectionFactory" ref="jmsTopicConnectionFactory"/>
        <property name="destination" ref="TestTopic" />
        <property name="messageListener" ref="MessageListener" />
        <property name="pubSubDomain">
            <value>true</value>
        </property>
    </bean>             
    
    <bean id="TestTopicJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref bean="jmsTopicConnectionFactory" />
        </property>
        <property name="defaultDestination">
            <ref bean="TestTopic" />
        </property>
        <property name="pubSubDomain">
            <value>true</value>
        </property>
    </bean>
</beans>                

I start the listener and it waits patiently.   I start the sender-listener
and it sends (receives) its 5 messages.  Then, somewhat later (approx. 5
minutes, I see a message that DiscoveryNetworkConnector.onServiceAdd has
been invoked, and it looks like it finds the listener process.

Here is the output of the sender-listener process:

[EMAIL PROTECTED] ~]$ /opt/java/bin/java -jar test-amq-peer.jar send
Loading Spring context...
        This should create the activemq listener and sender...
Aug 4, 2008 2:59:32 AM
org.springframework.context.support.AbstractApplicationContext
prepareRefresh
INFO: Refreshing
[EMAIL PROTECTED]:
display name
[EMAIL PROTECTED];
startup date [Mon Aug 04 02:59:32 CDT 2008]; root of context hierarchy
Aug 4, 2008 2:59:33 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[spring-config.xml]
Aug 4, 2008 2:59:33 AM
org.springframework.context.support.AbstractApplicationContext
obtainFreshBeanFactory
INFO: Bean factory for application context
[EMAIL PROTECTED]:
[EMAIL PROTECTED]
Aug 4, 2008 2:59:33 AM
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in
[EMAIL PROTECTED]:
defining beans
[propertyConfigurer,jmsTopicConnectionFactory,TestTopic,SenderBean,MessageListener,TestJmsTopicListenerContainer,TestTopicJmsTemplate];
root of factory hierarchy
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.BrokerService getBroker
INFO: ActiveMQ 4.1.1 JMS Message Broker (mybrokername) is starting
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.BrokerService getBroker
INFO: For help or more information please see:
http://incubator.apache.org/activemq/
Aug 4, 2008 2:59:33 AM
org.apache.activemq.transport.TransportServerThreadSupport doStart
INFO: Listening for connections at: tcp://dacar-collector:46775
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.TransportConnector start
INFO: Connector tcp://dacar-collector:46775 Started
Aug 4, 2008 2:59:33 AM org.apache.activemq.network.NetworkConnector doStart
INFO: Network Connector bridge Started
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.BrokerService start
INFO: ActiveMQ JMS Message Broker (mybrokername,
ID:dacar-collector-53258-1217836773407-1:0) started
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.TransportConnector start
INFO: Connector vm://mybrokername Started


Waiting 1 minute to allow initiation to complete.
Aug 4, 2008 2:59:33 AM org.apache.activemq.broker.jmx.ManagementContext$1
run
INFO: JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
Executing in SENDER mode...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sending message 0[New message at Mon Aug 04 03:00:33 CDT 2008 from thread
[EMAIL PROTECTED]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Received message # 0
Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false,
messageId = null, originalDestination = null, originalTransactionId = null,
producerId = null, destination = null, transactionId = null, expiration = 0,
timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent
= false, type = null, priority = 0, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
size = 0, properties = null, readOnlyProperties = false, readOnlyBody =
false, droppable = false}] at Mon Aug 04 03:00:33 CDT 2008 in listener
[EMAIL PROTECTED]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

{ ... messages 2 -4 sent and received within about 12 seconds -- snipped
from this log ..}
Aug 4, 2008 3:04:14 AM org.apache.activemq.network.DiscoveryNetworkConnector
onServiceAdd
INFO: Establishing network connection between from
vm://mybrokername?network=true to tcp://DACAR-ENGINE1:33096
Aug 4, 2008 3:04:14 AM
org.apache.activemq.network.DemandForwardingBridgeSupport startLocalBridge
INFO: Network connection between vm://mybrokername#4 and
tcp://DACAR-ENGINE1/10.15.2.104:33096(mybrokername) has been established.
Aug 4, 2008 3:09:14 AM org.apache.activemq.network.DiscoveryNetworkConnector
onServiceAdd
INFO: Establishing network connection between from
vm://mybrokername?network=true to tcp://DACAR-ENGINE1:33096
Aug 4, 2008 3:09:14 AM
org.apache.activemq.network.DemandForwardingBridgeSupport startLocalBridge
INFO: Network connection between vm://mybrokername#6 and
tcp://DACAR-ENGINE1/10.15.2.104:33096(mybrokername) has been established.


What I'm not sure about is, why so long?    I actually tried a version of
this test where I wait 6 minutes between the 4th and 5th message, and this
message still pops up several minutes after the last message.   So, to me,
that seems like it is somehow related not just purely to time, but to that
last message being delivered.

Note that when I run the listener and sender-listener on the same machine, I
get the "discovery" messages immediately:

Waiting 1 minute to allow initiation to complete.
Aug 4, 2008 3:22:21 AM org.apache.activemq.network.DiscoveryNetworkConnector
onServiceAdd
INFO: Establishing network connection between from
vm://mybrokername?network=true to tcp://dacar-collector:51954
Aug 4, 2008 3:22:21 AM
org.apache.activemq.network.DemandForwardingBridgeSupport startLocalBridge
INFO: Network connection between vm://mybrokername#2 and
tcp://localhost/127.0.0.1:51954(mybrokername) has been established.
Executing in SENDER mode...


Also, this looks like there are two brokers in play even within the
sender-listener process when they are on separate machines, but only one
when they are on the same machine.   Is that the way it's supposed to be?



-- 
View this message in context: 
http://www.nabble.com/Problems-with-simple-peer%3A---transport-config---Spring-tp18755772p18931248.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to