Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jboss 7(eap 6)wmq.jmsra.rar ejb3 mdb配置_Jboss_Jboss7.x_Ibm Mq_Message Driven Bean - Fatal编程技术网

jboss 7(eap 6)wmq.jmsra.rar ejb3 mdb配置

jboss 7(eap 6)wmq.jmsra.rar ejb3 mdb配置,jboss,jboss7.x,ibm-mq,message-driven-bean,Jboss,Jboss7.x,Ibm Mq,Message Driven Bean,我想在服务器配置中指定队列的位置(队列管理器和队列名称) 我有一个MDB,它只处理以下内容: MDB: @MessageDriven(name = "smis2/DelmeMDB" , activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigPropert

我想在服务器配置中指定队列的位置(队列管理器和队列名称)

我有一个MDB,它只处理以下内容:

MDB:

@MessageDriven(name = "smis2/DelmeMDB"
, activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/queue/CLQ"),
        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
        @ActivationConfigProperty(propertyName = "transportType", propertyValue = "BINDINGS"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
        }
, mappedName="java:/jms/queue/A"
)
@ResourceAdapter("wmq.jmsra.rar")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class DelmeMDB implements MessageListener {

    public DelmeMDB() {

    }
    @Override
    public synchronized void onMessage(Message message) {
        String msgStr = null;
        try {
            if (message instanceof BytesMessage) {
                BytesMessage bm = (BytesMessage) message;
                byte[] buf = new byte[(int)bm.getBodyLength()];
                bm.readBytes(buf);
                msgStr = new String(buf, "utf8");
            } else if (message instanceof TextMessage) {
                TextMessage txtMsg = (TextMessage) message;
                msgStr = txtMsg.getText();
            } else {
                throw new EJBException("Unrecognized message type");
            }

            if (msgStr != null) {
                System.out.printf("Got a message! %s%n", msgStr);
            }
        } catch (Exception e) {
            throw new EJBException(e);
        } finally {
        }
    }
}
在我的服务器配置中:

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
            <resource-adapters>
                <resource-adapter>
                    <archive>
                        wmq.jmsra.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                    <connection-definitions>
                        <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:/WMQCF" enabled="true" use-java-context="true" pool-name="WMQCF" use-ccm="true">
                            <config-property name="transportType">
                                ${pnp.mq.transportType:BINDINGS}
                            </config-property>
                            <config-property name="queueManager">
                                ${pnp.mq.queueManager:MB8QMGR}
                            </config-property>
                            <xa-pool>
                                <min-pool-size>1</min-pool-size>
                                <max-pool-size>5</max-pool-size>
                                <prefill>true</prefill>
                                <use-strict-min>true</use-strict-min>
                                <flush-strategy>FailingConnectionOnly</flush-strategy>
                            </xa-pool>
                            <validation>
                                <background-validation>false</background-validation>
                                <use-fast-fail>false</use-fast-fail>
                            </validation>
                        </connection-definition>
                    </connection-definitions>
                    <admin-objects>
                        <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:/jms/queue/CLQ" enabled="true" use-java-context="false" pool-name="java:/jms/queue/CLQ">
                            <config-property name="baseQueueManagerName">
                                ${pnp.mq.queueManager:MB8QMGR}
                            </config-property>
                            <config-property name="baseQueueName">
                                CLQ
                            </config-property>
                        </admin-object>
                    </admin-objects>
                </resource-adapter>
            </resource-adapters>
        </subsystem>

wmq.jmsra.rar
X交易
${pnp.mq.transportType:BINDINGS}
${pnp.mq.queueManager:MB8QMGR}
1.
5.
真的
真的
仅连接失败
假的
假的
${pnp.mq.queueManager:MB8QMGR}
CLQ
现在,只要我连接的队列管理器是系统上的默认队列管理器,这项功能就可以工作。我尝试切换到另一个本地队列管理器(不是默认队列管理器),即使管理员对象被适当更新,它也无法工作。无论如何,我不希望依赖于系统范围的默认值,而是显式地声明队列管理器

或者,我可以设置useJNDI=false,并在jboss-ejb3.xml中提供:

    <message-driven>
        <ejb-name>smis2/DelmeMDB</ejb-name>
        <ejb-class>pnp.smis2.ejb.DelmeMDB</ejb-class>
        <activation-config>
            <activation-config-property>
                <activation-config-property-name>transportType</activation-config-property-name>
                <activation-config-property-value>${pnp.mq.transportType}</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>queueManager</activation-config-property-name>
                <activation-config-property-value>${pnp.mq.queueManager}</activation-config-property-value>
            </activation-config-property>
        </activation-config>
    </message-driven>
</enterprise-beans>


smis2/DelmeMDB
pnp.smis2.ejb.DelmeMDB
运输类型
${pnp.mq.transportType}
队列管理器
${pnp.mq.queueManager}
这很好,而且我可以通过使用系统属性替换来指定激活规范选项的完整补充。但是,如果我需要对jboss-ejb3.xml进行结构更改以部署到我的本地、开发、qa和生产环境中,则很难(不可能?)使用此方案

如何消除jboss-ejb3.xml,并通过在standalone.xml(或domain.xml)中混合特定于节点的项和更通用的选项(如
@activationconfigproperty
s)来提供配置