如何在JBoss的远程JMS队列中编写

时间:2014-02-17 14:25:23

标签: java jms jboss7.x activemq

我正在使用JBoss Wildfly,喜欢从会话Bean中生成远程(非嵌入式)JMS队列(active-mq-5.9)中的消息。

我的豆子:

@Stateless
@ResourceAdapter("activemq-ra.rar")
public class FinancialLoggerBean implements FinancialLoggerRemote, ManagedBean {

    private static final Logger logger = Logger.getLogger(FinancialLoggerBean.class.getName());

    @Resource(lookup = "jboss/ConnectionFactory")
    private ConnectionFactory connectionFactory;

    @Resource(lookup = "jboss/queue/financialLogQueue")
    private Destination destination;

    private Connection connection;

    @EJB
    private FinancialLoggerBeanManager ejbManager;

    ...
}

我在网上找到了一些如何通过资源适配器配置jboss和active-mq之间的链接的示例。在我的standalone.xml中,我已经像这样配置了适配器:

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
        <resource-adapters>
            <resource-adapter>
                    <archive>
                        activemq-rar.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                    <config-property name="UseInboundSession">
                        false
                    </config-property>
                    <config-property name="ServerUrl">
                        failover:(tcp://127.0.0.1:61616)
                    </config-property>
                    <connection-definitions>
                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:jboss/ConnectionFactory" enabled="true" pool-name="ConnectionFactory">
                            <xa-pool>
                            <min-pool-size>10</min-pool-size>
                            <max-pool-size>100</max-pool-size>
                            <prefill>true</prefill>
                      </xa-pool>
                        </connection-definition>
                    </connection-definitions>
                    <admin-objects>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/queue/financialLogQueue" use-java-context="true" pool-name="financialLogPool">
                            <config-property name="PhysicalName">
                                financialLogQueue
                            </config-property>
                        </admin-object>
                    </admin-objects>
                </resource-adapter>
        </resource-adapters>

但是资源无法链接到我的bean。似乎缺少一些东西。

JBAS014775:    New missing/unsatisfied dependencies:
  service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env.jboss.ConnectionFactory (missing) dependents: [service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env."myBeans.FinancialLoggerBean".connectionFactory] 
  service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env.jboss.queue.financialLogQueue (missing) dependents: [service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env."myBeans.FinancialLoggerBean".destination] 

任何提示?

谢谢,

米歇尔

1 个答案:

答案 0 :(得分:2)

在JBoss库管理中看起来像MQ模块中的配置问题。