rabbitmq-consistent-hash-exchange 与 java-client/spring-rabbit [英] rabbitmq-consistent-hash-exchange with java-client / spring-rabbit

查看:28
本文介绍了rabbitmq-consistent-hash-exchange 与 java-client/spring-rabbit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 java 客户端的 rabbitmq-consistent-hash-exchange 的功能,或者最好使用 spring 抽象 spring-amqp.不幸的是,我没有找到解释 java 用法并引用要包含的 jar 依赖项的示例,请指教.

I would like to use the capabilities of rabbitmq-consistent-hash-exchange from java client or preferably by using the spring abstraction spring-amqp. Unfortunately I failed to found an example that explain the java usage and reference a jar dependency to include, please advice.

推荐答案

x-"交换没有特定的标签.为此使用 CustomExchange:

There is no specific tag for "x-" exchanges. Use CustomExchange for it:

   <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>

这篇关于rabbitmq-consistent-hash-exchange 与 java-client/spring-rabbit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆