我希望使用来自java客户端的rabbitmq一致散列交换的功能,或者最好使用spring抽象spring-amqp。不幸的是,我没有找到一个示例来解释java的用法,并引用一个jar依赖项来包含,请提出建议。
发布于 2015-07-01 09:08:18
没有"x-“交换的特定标记。对它使用CustomExchange:
<bean id="requestHashExchangeTest" class="org.springframework.amqp.core.CustomExchange">
<constructor-arg name="name" value="test.hash.RequestExchange"/>
<constructor-arg name="type" value="x-consistent-hash"/>
<constructor-arg name="durable" value="true"/>
<constructor-arg name="autoDelete" value="false"/>
<property name="adminsThatShouldDeclare">
<list>
<ref bean="rabbitAdminConnectionFactory" />
</list>
</property>
</bean>
<bean name="binding" class="org.springframework.amqp.rabbit.config.BindingFactoryBean">
<property name="exchange" value="test.random.RequestExchange" />
<property name="destinationQueue" ref="request.queue" />
<property name="shouldDeclare" value="true" />
<property name="adminsThatShouldDeclare">
<list>
<ref bean="rabbitAdminConnectionFactory" />
</list>
</property>
<property name="routingKey" value="10" />
</bean>发布于 2015-06-30 15:53:41
不支持使用Spring提供(声明)插件交换,但是您可以向服务器上配置的任何exchange类型发送消息。
只需将交换直接添加到rabbitmq,然后像向任何交换一样向其发送消息。
有关如何使用Spring,请参见参考文献;它有指向示例等的链接。
https://stackoverflow.com/questions/31141955
复制相似问题