I'm trying to get simple peer-configuration to work and keep failing. I have
one two PC's and I want to run a message producer on PC1 and a consumer on
PC2. I've tried this with verious AMQ versions from 5.3.0 to 5.5.0-Snapshot
but nothing seems to work. I'm quite new to AMQ so not sure if the issue is
with my configurations or somewhere else. I'm using 5.5.0-Snapshot here as
5.4.1 gives me some KahaDB-null page errors that seem to be fixed on 5.5.0.

I've scraped up my test code from some googled examples, so there might be
some trivial mishap there also, not sure.

My configuration on the consumer side is like this (removed various
xmlns-stuff etc):
<beans>
        <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory"
                p:brokerURL="peer://test/broker1" />

        <bean id="listener" class="fi.my.test.RTMessageListener" />

        <jms:listener-container container-type="default"
                connection-factory="connectionFactory" acknowledge="auto">
                <jms:listener destination="world" ref="listener"
                        method="onMessage" />
        </jms:listener-container>
</beans>

On the producer side it looks like this:
<beans>
        <bean id="client" class="fi.my.test.RTMessageProducer"
                autowire="byType" />

        <bean id="jmsFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory"
                p:brokerURL="peer://test/broker2" />

        <amq:queue id="destination">
                <constructor-arg value="world" />
        </amq:queue>

        <bean id="clientJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
                <property name="connectionFactory">
                        <bean 
class="org.springframework.jms.connection.SingleConnectionFactory">
                                <property name="targetConnectionFactory">
                                        <ref local="jmsFactory" />
                                </property>
                        </bean>
                </property>
        </bean>

</beans>

The idea is that I start the consumer on PC2, then the producer on PC1 and
the producer spits out 1000 messages which I get on the consumer. This is
all just for testing.

When I startup the consumer side, I get this output:
---
Refreshing
org.springframework.context.support.classpathxmlapplicationcont...@e2eec8:
startup date [Tue Oct 26 10:40:13 EEST 2010]; root of context hierarchy
Loading XML bean definitions from class path resource [beans_peer.xml]
Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@1319c:
defining beans
[connectionFactory,listener,org.springframework.jms.listener.DefaultMessageListenerContainer#0];
root of factory hierarchy
Starting beans in phase 2147483647
Using Persistence Adapter: MemoryPersistenceAdapter
ActiveMQ 5.5-SNAPSHOT JMS Message Broker (broker1) is starting
For help or more information please see: http://activemq.apache.org/
JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
Listening for connections at: tcp://localhost:2686
Connector tcp://localhost:2686 Started
Network Connector localhost Started
ActiveMQ JMS Message Broker (broker1, ID:WL100103-2685-1288078813793-1:1)
started
Connector vm://broker1 Started
---
and when starting the producer, the server outputs this:
---
Establishing network connection from vm://broker1?async=false&network=true
to tcp://localhost:3881
broker1 Shutting down
broker1 bridge to Unknown stopped
Could not start network bridge between:
vm://broker1?async=false&network=true and: tcp://localhost:3881 due to:
java.net.ConnectException: Connection refused: connect
---

And I'm not receiving anything.


On the client side, I get this:
----
Refreshing
org.springframework.context.support.classpathxmlapplicationcont...@19bd03e:
startup date [Tue Oct 26 10:40:41 EEST 2010]; root of context hierarchy
Loading XML bean definitions from class path resource [beans_peer.xml]
Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@c88440:
defining beans [client,jmsFactory,destination,clientJmsTemplate]; root of
factory hierarchy
*** START MESSAGE SENDING ***
Using Persistence Adapter: MemoryPersistenceAdapter
ActiveMQ 5.5-SNAPSHOT JMS Message Broker (broker2) is starting
For help or more information please see: http://activemq.apache.org/
JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
Listening for connections at: tcp://localhost:3881
Connector tcp://localhost:3881 Started
Network Connector localhost Started
ActiveMQ JMS Message Broker (broker2, ID:WD080208-3880-1288078841926-1:1)
started
Connector vm://broker2 Started
Established shared JMS Connection: ActiveMQConnection
{id=ID:WD080208-3880-1288078841926-3:1,clientId=null,started=false}
*** END MESSAGE SENDING ***
Total time ms 875
Time per one msg 0.875
Establishing network connection from vm://broker2?async=false&network=true
to tcp://localhost:2686
broker2 Shutting down
Could not start network bridge between:
vm://broker2?async=false&network=true and: tcp://localhost:2686 due to:
java.net.ConnectException: Connection refused: connect
broker2 bridge to Unknown stopped
-----
So it looks like the client manages to do 1000 of those sends (total time
875ms) but nothing is received on the server side.

Soo.... From what I get out of those is that the it's localhost everywhere?
Shouldn't PC1 see the port on PC1 and otherway around? I'd expect the
embedded brokers on PC1 and PC2 trying to connect to each others ports and
not to localhost???

Is this an AMQ issue or is the problem in my config...??? Any way around it?

NOTE: WL100103 is the name of the consumer side PC and WD080208 is the name
of the producer side PC and both are in DNS and each one can ping the other
with those names. Both machines are on the same subnet and actually
connected to the same LAN-switch.
-- 
View this message in context: 
http://activemq.2283324.n4.nabble.com/Problem-with-simple-peer-configuration-my-config-or-AMQ-issue-tp3013268p3013268.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to