使用Apache ActiveMQ WCF绑定配置问题进行双工或请求 - 回复

Bar*_*urt 5 apache wcf activemq-classic nms

我试图使用Apache.NMS.WCF绑定WCF应用程序并获得以下错误 -

合同需要TwoWay(请求 - 回复或双工),但是Binding'NmsBinding'不支持它,或者没有正确配置以支持它.

我的system.service模型看起来像这样 -

    <bindings>
        <nmsBinding>
            <binding 
                name="myNMSBinding" 
                destination="test.queue" 
                destinationType="TemporaryQueue"
                >
            </binding>
        </nmsBinding>
    </bindings>

    <extensions>
        <!--<bindingElementExtensions>
            <add name="nmsTransPort" 
                 type="Apache.NMS.WCF.NmsTransportElement, Apache.NMS.WCF, Version=1.1.0.1642, Culture=neutral, PublicKeyToken=82756feee3957618" />
        </bindingElementExtensions>-->
        <bindingExtensions>
            <add name="nmsBinding" 
                 type="Apache.NMS.WCF.NmsBindingCollection, Apache.NMS.WCF, Version=1.1.0.1642, Culture=neutral, PublicKeyToken=82756feee3957618" 

                 />
        </bindingExtensions>
    </extensions>

    <services>
        <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior">
            <!-- Service Endpoints -->
            <endpoint 
                address="tcp://localhost:61616" 
                binding="nmsBinding" 
                bindingConfiguration="myNMSBinding" 
                contract="WcfService1.IService1"
                />
        </service>
    </services>
Run Code Online (Sandbox Code Playgroud)

有没有办法将Apache NMS配置为双工或者它不支持它?

mar*_*c_s 6

像ActiveMQ这样的消息队列通常只是设计一个单向的东西 - 你可以将消息放入其中,这就是它.

如果您确实需要回复,那么真正的解决方案是扭转角色:您在主合同上发送消息的服务(单向)将成为客户端,在第二个队列上向您发送响应,您的应用程序在该队列上正在监听服务器.

查看有关主题的一些MSDN文档和其他资源:

这些示例通常使用MSMQ,因为WCF本身支持MSMQ,但是将您的任务分解为两个单独的单向合同以及如何设置和使用两个单独的请求和响应队列的基本原则也应该适用于ActiveMQ.

  • @Noctris:并且这也适用于WCF绑定吗?问题显然是关于使用来自WCF的ActiveMQ**** - 而不是它的一般功能...... (2认同)