【问题标题】:Duplex or request-reply with Apache ActiveMQ WCF Binding configuration questionDuplex or request-reply with Apache ActiveMQ WCF Binding 配置问题
【发布时间】:2023-03-15 07:01:01
【问题描述】:

我正在尝试将 Apache.NMS.WCF 绑定用于 WCF 应用程序并收到以下错误 -

Contract 需要 TwoWay(请求-回复或双工),但绑定 '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>

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

【问题讨论】:

    标签: wcf apache activemq nms


    【解决方案1】:

    像 ActiveMQ 这样的消息队列通常在设计上只是一种单向的东西 - 您可以将消息放入其中,仅此而已。

    如果您确实需要回复,真正的解决方案是颠倒角色:您在主合同上发送消息的服务(单向)将成为在第二个队列上向您发送回复的客户端,在您的应用正在作为服务器侦听。

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

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

    【讨论】:

    • 我对此投了反对票,因为它不正确。 ActiveMQ 为您提供了多种请求-响应方式。其中之一是临时队列,您可以将其用作消息的返回地址。这个“临时队列”有一个临时消费者..
    • @Noctris:这也适用于 WCF 绑定吗?问题显然是关于使用 ActiveMQ 来自 WCF - 而不是它的一般功能......
    猜你喜欢
    • 2011-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    • 2015-05-06
    • 1970-01-01
    • 2011-08-02
    • 2017-11-26
    相关资源
    最近更新 更多