activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From new2mq <chris.gooda...@sungard.com>
Subject Re: Problems with simple peer:// transport config & Spring
Date Mon, 04 Aug 2008 15:35:09 GMT

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:

[goodacre@dacar-collector ~]$ /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
org.springframework.context.support.ClassPathXmlApplicationContext@1174b07:
display name
[org.springframework.context.support.ClassPathXmlApplicationContext@1174b07];
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
[org.springframework.context.support.ClassPathXmlApplicationContext@1174b07]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@1e59128
Aug 4, 2008 2:59:33 AM
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1e59128:
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
com.ssi.exp.TestMessageSender@8b8a47]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
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
com.ssi.exp.TestMessageListener@3a1834
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

{ ... 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.

Also, this looks like there are two brokers in play even within the
sender-listener process.   Is that the way it's supposed to be?




I gave that a try with rather mixed results.

The very time I deployed the new jar, it looked like discovery may have
succeeded between machine A (listen/send) and machine B(listen-only),
because machine B  complained that it could not resolve machine A's
hostname:

INFO: JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
Aug 1, 2008 8:35:15 AM org.apache.activemq.network.DiscoveryNetworkConnector
onServiceAdd
INFO: Establishing network connection between from
vm://mybrokername?network=true to tcp://dacar-collector:44832
Aug 1, 2008 8:35:15 AM org.apache.activemq.network.DiscoveryNetworkConnector
onServiceAdd
WARNING: Could not start network bridge between:
vm://mybrokername?network=true and: tcp://dacar-collector:44832 due to:
java.net.UnknownHostException: dacar-collector


I'm close!  I thought, and promptly added an  /etc/hosts file entry on both
boxes (each for the other).   

However, subsequent tests failed to give any indication that discovery had
completed -- in fact I never see a line after this (when running as listener
only):
INFO: JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

What logging can I turn up (and how do I do it with or without Spring) to
get better visibility into the discovery process?    

-chris


I will give that a try and post back with the results.   Am I correct in
assuming that, at least after a cursory review, it looks like this *should*
work?  For example, there's nothing flagrantly wrong with the peer URI?  
Should it be the same URI in both peers (I assume so).  There's no explicit
broker configuration that needs be done? 

Thanks for taking a look at this, Rob.

-chris


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


Mime
View raw message