You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Allen Teng <ss...@gmail.com> on 2008/08/05 17:11:08 UTC
can not consume messages on broker network.
Hello All
i'v encountered strange problem on message consuming on broker network .
i have 2 computers M1 and M2 each with an embedded broker on it . assume B1
on M1 and B2 on M2,
and each of the broker has a queue with same queue name(test-queue).
B2 has configuring a network of brokers with duplex .
(...
<amq:networkConnectors>
<amq:networkConnector uri="static://([uri-of-B1])" duplex="true"/>
</amq:networkConnectors>
... )
B1 has no configration of network connectors .
B1 is config to integrate with jboss by activemq-ra and B2 is a simple
broker in vm .
Producer(P) connect to B1 and Consumer(C) connect to B2.
i write a test to send out 1000 messages by P , and according to the log
of C , all the messages
are received . but when i restart C , C will receive those messages again
.
i try to monitor the test-queue on B1 by hermes-jms and found that all the
messages in test-queue on B1
never be removed . when C is startup to consume messages , messages act
just like be "copy to" test-queue on B2
and these messages on test-queue(B2) will be removed after they are
consumed , but nothing happens to
the messages on test-queue(B1).
in activemq's document , i found that " A Store and Forward Network of
Brokers means the messages travel from broker
to broker until they reach a consumer; with each message being owned by a
single broker at any point in time." ,
so the message cant be in both test-queue on B1 and B2 . but this is
exactlly not what i see .
i dont know whether it is a configration problem or anything else . could
someone shed any light on it ?
i appreciated very much for any help .
my environment and codes/configurations :
M1 : windows xp , jdk1.6.0_03 , jboss-4.2.2.GA , activemq-5.0.0 ,
activemq-ra-5.0 , spring2.5
some configuration for B1 ( i only post those part which i'v changed it ) :
1) ra.xml in activemq-ra.rar\META-INF
....
<resourceadapter>
....
<config-property>
...
<config-property-name>ServerUrl</config-property-name>
....
<config-property-value>vm://localhost</config-property-value>
</config-property>
....
<config-property>
....
<config-property-name>BrokerXmlConfig</config-property-name>
....
<config-property-value>xbean:broker-config.xml</config-property-value>
</config-property>
....
2) broker-config.xml in activemq-ra.rar
....
<broker useJmx="true" brokerName="test.broker"
xmlns="http://activemq.org/config/1.0">
....
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../data/activemq"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="parcel.broker.openwire"
uri="tcp://localhost:61616"/>
</transportConnectors>
<networkConnectors>
</networkConnectors>
....
....
3) activemq-jms-ds.xml in my jboss configuration (
%jboss_home%/server/default/deploy)
....
<connection-factories>
<tx-connection-factory>
....
<jndi-name>activemq/QueueConnectionFactory</jndi-name>
....
<ServerUrl>tcp://localhost:61616</ServerUrl>
....
....
4) spring config for producer
....
<jee:jndi-lookup id="jmsFactory"
jndi-name="java:activemq/QueueConnectionFactory" />
<bean id="simpleConverter"
class="org.springframework.jms.support.converter.SimpleMessageConverter" />
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsFactory" />
<property name="messageConverter" ref="converter" />
</bean>
<bean id="converter" class="com.al.SimpleConverter">
<property name="converter" ref="simpleConverter"/>
</bean>
<bean id="sender" class="com.al.producer.DefaultSender">
<property name="template" ref="jmsTemplate" />
<property name="destinationName" value="test-queue" />
</bean>
....
5) code for producer
http://www.nabble.com/file/p18833203/DefaultSender.java DefaultSender.java
6) code for send messages
...
DefaultSender sender = (DefaultSender)context.getBean("sender");
int idx = 0;
while (idx < SimpleMessageHelper.payloads.size()) {
sender.sendMessage(SimpleMessageHelper.genSimpleMessage(idx++));
}
...
M2 : windows xp , jdk1.6.0_01 , activemq-5.0.0 ,spring2.5
1) spring config for consumer
http://www.nabble.com/file/p18833203/spring_consumer.xml
spring_consumer.xml
2) code for consumer
http://www.nabble.com/file/p18833203/DefaultListener.java
DefaultListener.java
Code for helper class used in both side of B1 and B2
http://www.nabble.com/file/p18833203/SimpleMessageHelper.java
SimpleMessageHelper.java
http://www.nabble.com/file/p18833203/SimpleConverter.java
SimpleConverter.java
http://www.nabble.com/file/p18833203/SimpleMessage.java SimpleMessage.java
http://www.nabble.com/file/p18833203/spring_consumer.xml
spring_consumer.xml
One of messages which left in test-queue(B1) , i copy it from ui of
herme-jms
ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
ID:erry-al-4741-1217940624875-3:0:1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:erry-al-4741-1217940624875-3:0:1:1,
destination = queue://test-in, transactionId = null, expiration = 0,
timestamp = 1217940649078, arrival = 0,
brokerInTime = 1217940649093, brokerOutTime = 1217944061875,
correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
null, dataStructure = null,
redeliveryCounter = 18, size = 0, properties = null, readOnlyProperties =
true, readOnlyBody = true,
droppable = false, text = .... }
--
View this message in context: http://www.nabble.com/can-not-consume-messages-on-broker-network.-tp18833203p18833203.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.