activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M4RC0 <m4rc0.mad...@gmail.com>
Subject Re: HOWTO resend msgs from embedded broker to remote broker that was down
Date Tue, 01 Jul 2008 13:27:07 GMT

I'm ussing AMQ 5.0
better, I post my spring jms configuration:
<!-- local broker connection factory to assume all local jms messages -->
	<bean id="localJmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL" value="vm://localhost" />
	</bean>

	<!-- common jms template for all producers, all messages must be received
in local connection factory  -->
	<bean id="localJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="localJmsConnectionFactory" />
		<property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
		<property name="defaultDestination" ref="destination"/>
		<qualifier value="localJmsTemplate"/>
	</bean>

	<!-- default destination for local messages -->
	<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue"
autowire="constructor">
		<constructor-arg value="defaultLocalQueue" />
	</bean>
	
	<!--  listener container for receiving local messages and dispatch them to
each respective remote queue -->
	<bean
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="localJmsConnectionFactory" />
		<property name="destination" ref="destination" />
		<property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
		<property name="messageListener">
			<bean class="com.mycompany.jms.MessageRouterListener">
				<constructor-arg ref="remoteJmsTemplate" />
			</bean>
		</property>
	</bean>
	
	<!-- jms template to be used by the local dispatcher listener to deliver
messages to remote jms server -->
	<bean id="remoteJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory">
			<!-- lets wrap in a pool to avoid creating a connection per send -->
			<bean class="org.springframework.jms.connection.SingleConnectionFactory">
				<property name="targetConnectionFactory"
ref="remoteJmsConnectionFactory" />
			</bean>
		</property>
		<property name="defaultDestination" ref="destination"/>
		<qualifier value="remoteJmsTemplate"/>
	</bean>
	
	<!-- remote broker connection factory where finally jms messages will be
delivered -->
	<bean id="remoteJmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL"
value="tcp://remotehost:61616?wireFormat.maxInactivityDuration=0" />
	</bean>
-- 
View this message in context: http://www.nabble.com/HOWTO-resend-msgs-from-embedded-broker-to-remote-broker-that-was-down-tp18214129p18214371.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message