【发布时间】:2019-07-05 23:21:38
【问题描述】:
我正在使用 JBoss EAP 7、WMQ 资源适配器连接到 WMQ 和 AMQ 资源适配器用于 AMQ。我必须从 AMQ 获取消息做一些逻辑并将其放入 WMQ。每当 JMSProducer 向 WMQ 发送消息时,大约需要 3-5 秒。
我的资源适配器配置:
<resource-adapter id="com.wmq.jmsra.main">
<archive>
com.wmq.jmsra.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<config-property name="connectionConcurrency">
2
</config-property>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="${wmq.jndi.factory}" enabled="true" tracking="false" use-java-context="true" pool-name="WMQConnectionFactory">
<config-property name="hostName">
${mq.wmq.host}
</config-property>
<config-property name="password">
${mq.wmq.input.password}
</config-property>
<config-property name="queueManager">
${mq.wmq.manager}
</config-property>
<config-property name="port">
${mq.wmq.port}
</config-property>
<config-property name="channel">
${mq.wmq.channel}
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="sslCipherSuite">
TLS_RSA_WITH_AES_128_CBC_SHA
</config-property>
<config-property name="username">
${mq.wmq.input.user}
</config-property>
<xa-pool>
<min-pool-size>1</min-pool-size>
<initial-pool-size>1</initial-pool-size>
<max-pool-size>50</max-pool-size>
<fair>false</fair>
<no-tx-separate-pools>false</no-tx-separate-pools>
</xa-pool>
<recovery>
<recover-credential>
<user-name>${mq.wmq.input.user}</user-name>
<password>${mq.wmq.input.password}</password>
</recover-credential>
</recovery>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="${wmq.jndi.destination}" use-java-context="true" pool-name="wmq_queue_out">
<config-property name="baseQueueName">
${mq.wmq.output}
</config-property>
<config-property name="baseQueueManagerName">
${mq.wmq.manager}
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
我的 AMQ MDB:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "${mq.amq.main.input}"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
})
@ResourceAdapter("com.amq.jmsra.main")
public class MessageOnCryptServerToBank implements MessageListener {
@Inject
@JMSConnectionFactory("${wmq.jndi.factory}")
private JMSContext context;
@Resource(mappedName = "${wmq.jndi.destination}")
private Destination queue;
@Override
public void onMessage(Message message) {
String msgFromAmq = getTextFromMessage(message);
// some logic
TextMessage textMessage = context.createTextMessage(msgToWMQ);
JMSProducer producer = context.createProducer();
producer.send(queue, textMessage);
}
}
我在每个字符串周围添加基准测试,以检测其中哪些会冻结我的应用程序。结果是producer.send()。告诉我我做错了什么?
【问题讨论】:
标签: java jms ibm-mq jboss-eap-7