// On VM1:
<bean id="jmsFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>failover:(tcp://localhost:61616,tcp://VM2:61616)?initialReconnectDelay=100</value>
</property>
</bean>
<bean id="messageDispatchTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="jmsFactory" />
</property>
<property name="pubSubDomain">
<value>true</value>
</property>
</bean>
On VM2, the configuration is the same (and hence assymetrical):
// On VM2:
<bean id="jmsFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>failover:(tcp://VM1:61616,tcp://localhost:61616)?initialReconnectDelay=100</value>
</property>
</bean>
<bean id="messageDispatchTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="jmsFactory" />
</property>
<property name="pubSubDomain">
<value>true</value>
</property>
</bean>
.
The messages are sent to all subscribers on the local host.
Thanks,
/U
-------------- Original message ----------------------
From: "James Strachan" <[EMAIL PROTECTED]>
> On 5/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > I am connecting two (Tomcat) JDK 1.6 VMs using 4.1.1 external broker
> > as follows:
> >
> > VM1 (broker 1) <--------------------------------- VM2
> (broker 2)
> > (main: broker 1)
> >
> (main: broker 1)
> > (failover: broker 2)
> >
> (failover: broker2)
> >
> > I have a topic MyConfigChange. There are three subscribers to
> > this topic on both VM1 and VM2 (one in each webapp of the Tomcat VM).
> >
> > I find that when VM1 publishes a message on this topic, the message is
> > not deivered to all the subscribers on VM2.
> >
> > Example:
> > There are three webapps in VM2, and in each webapp, there is a
> > subscriber
> > to the topic MyConfigChange. Let's call the subscribers S1, S2 and S3.
> > When a webapp in VM1 publishes three MyConfigChange messages
> > M1, M2 and M3, I find that often S1 would get M1 and M2, and S2 would get
> > M3. At other times, S1 and S2 would get M1, M3 and S3 would receive M2
> > and so on.
> >
> > Am I not guaranteed that all subscribers S1, S2 and S3 would receive all
> > the issues messages on the topic, regardless of where the message was
> published
> > (whether Vm1 or Vm2)?
> >
> > This is my configuration:
> >
> > <bean
> > id="MyConfigChangeMessageListener"
> >
> class="org.springframework.jms.listener.SimpleMessageListenerContainer"
> > >
> > <property name="sessionAcknowledgeModeName"
> value="AUTO_ACKNOWLEDGE"/>
> > <property name="connectionFactory" ref="jmsFactory" />
> > <property name="destination" ref="topicCONFIG_CHANGE" />
> > <property name="messageListener" ref="Postmaster" />
> > </bean>
> >
> > (There is one instance of "Postmaster" in each webapp).
> >
> > Any help appreciated,
>
> Does it work fine if you have just 1 broker? How are you networking
> the 2 brokers together? How are you configuring your
> ActiveMQConnectionFactory?
> --
> James
> -------
> http://macstrac.blogspot.com/