spring接收qpid fanout 消息

<!-- qpid connectionFactorys -->
	
	<bean id="qpidConnectionFactory_in_1" class="org.apache.qpid.client.AMQConnectionFactory">
		<constructor-arg value="amqp://guest:guest@test/?brokerlist='tcp://192.168.1.230:5672'" />
	</bean>
	
	<!-- destinations -->
	<bean id="qpid_queue_in_1" class="org.apache.qpid.client.AMQAnyDestination">
		<constructor-arg value="BURL:fanout://HENRY_MSG_GATEWAY_QUEUE//402881f247cd1e010147cec132280001#HENRY_MSG_GATEWAY_QUEUE" />
	</bean>
	
	<!-- listeners -->
	<bean id="qpid_listener_in_1" class="service.QpidListener">
	</bean>
	
	<!-- containers -->
	<bean id="jmsListenerContainer_in_1" class="org.springframework.jms.listener.SimpleMessageListenerContainer" lazy-init="false">   
		<property name="connectionFactory" ref="qpidConnectionFactory_in_1"></property>   
		<property name="destination" ref="qpid_queue_in_1"></property>   
		<property name="messageListener" ref="qpid_listener_in_1"></property>   
		<property name="concurrentConsumers" value="1"></property>
	</bean>
BURL:fanout://HENRY_MSG_GATEWAY_QUEUE//402881f247cd1e010147cec132280001#HENRY_MSG_GATEWAY_QUEUE

fanout要使用BURL的方式设置目标。

默认的是ADDR

从以下源码AMQDestination.java下找到:

protected void parseDestinationString(String str) throws URISyntaxException
    {
        _destSyntax = getDestType(str);
        str = stripSyntaxPrefix(str);
        if (_destSyntax == DestSyntax.BURL)
        {    
            getInfoFromBindingURL(new AMQBindingURL(str));            
        }
        else
        {
            this._address = createAddressFromString(str);
            try
            {
                getInfoFromAddress();
            }
            catch(Exception e)
            {
                URISyntaxException ex = new URISyntaxException(str,"Error parsing address");
                ex.initCause(e);
                throw ex;
            }
        }
        _logger.debug("Based on " + str + " the selected destination syntax is " + _destSyntax);
    }


你可能感兴趣的:(spring接收qpid fanout 消息)