使用1个MDB来使用群集上的所有消息

时间:2015-11-06 21:10:09

标签: jms cluster-computing wildfly message-driven-bean

我正在使用WildlFly 10 CR3,我在群集上有2个artemis服务器。

我可以在群集的每个节点上使用单个MDB吗?

这是我的MDB

@TransactionManagement(TransactionManagementType.CONTAINER)
@MessageDriven(name = "RemoteJMSADuarteConsumer", activationConfig = {
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "java:/jms/remoteCFDP"),              
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "testQueue"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1"),
    @ActivationConfigProperty(propertyName = "useJDNI", propertyValue = "false"),
    })
public class RemoteJMSADuarteConsumer implements MessageListener {


    public RemoteJMSADuarteConsumer() {
        // TODO Auto-generated constructor stub
    }

    public void onMessage(Message rcvMessage) {
        // Proccesing message
    }

}

这是我的standalone.xml

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
        <server name="default">
            <security-setting name="#">
                <role name="guest" delete-non-durable-queue="true" create-non-durable-queue="true" consume="true" send="true"/>
            </security-setting>
            <address-setting name="#" message-counter-history-day-limit="10" page-size-bytes="2097152" max-size-bytes="10485760" expiry-address="jms.queue.ExpiryQueue" dead-letter-address="jms.queue.DLQ"/>
            <http-connector name="http-connector" endpoint="http-acceptor" socket-binding="http"/>
            <http-connector name="http-connector-throughput" endpoint="http-acceptor-throughput" socket-binding="http">
                <param name="batch-delay" value="50"/>
            </http-connector>
            <remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
            <remote-connector name="remote-artemis-dprato" socket-binding="remote-artemis-dprato"/>
            <remote-connector name="remote-artemis-aduarte" socket-binding="remote-artemis-aduarte"/>
            <in-vm-connector name="in-vm" server-id="0"/>
            <http-acceptor name="http-acceptor" http-listener="default"/>
            <http-acceptor name="http-acceptor-throughput" http-listener="default">
                <param name="batch-delay" value="50"/>
                <param name="direct-deliver" value="false"/>
            </http-acceptor>
            <in-vm-acceptor name="in-vm" server-id="0"/>
            <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
            <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
            <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
            <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
            <pooled-connection-factory name="activemq-ra" transaction="xa" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm"/>
            <pooled-connection-factory name="remote-artemis" entries="java:/jms/remoteCF" connectors="remote-artemis"/>
            <pooled-connection-factory name="remote-artemis-dprato" entries="java:/jms/remoteCFDP" connectors="remote-artemis-dprato"/>
            <pooled-connection-factory name="remote-artemis-aduarte" entries="java:/jms/remoteCFAD" connectors="remote-artemis-aduarte"/>
        </server>

我有2个PooledConnectionFactories到这个例子

  • 连接到第一个artemis服务器节点的remote-artemis
  • 连接到第二个artemis服务器节点的remote-artemis-aduarte

我正在尝试配置我的MDB以验证第一个节点队列是否为空,看看下一个节点...这可能吗?

0 个答案:

没有答案