1

我是 Mulesoft Anypoint Studio 的新手,刚刚开始探索它。我的流程从从 MQ 读取消息开始,到将其放在目的地结束,从我的本地机器开始,稍后会发展。我遇到了队列具有涉及密钥库和信任库的 TSL 的问题。现在,在 Anypoint 中,我看到了 WMQ 和 HTTPS/TSL 连接器。我已将 TSL 上下文设置为全局元素,但如何将其设置为 WMQ 连接器的一部分?具有正确 TLS 设置(密钥库、信任库等)的 Java 代码可以访问相同的队列和/或通道,但在 studion 中,我目前遇到此异常:

根异常为:MQJE001:发生 MQException:完成代码 2,原因 2009 MQJE016:MQ 队列管理器在连接期间立即关闭通道关闭原因 = 2009。类型:com.ibm.mqservices.MQInternalException

在谷歌上搜索时,我没有遇到任何带有 TLS 的 WMQ 示例代码。非常感谢任何线索/见解。

先感谢您!

4

1 回答 1

1
  1. 如下创建 MQQueueConnectionFactory bean
<spring:bean id="MQConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
           <spring:property name="hostName" value="${hostName}"/>
           <spring:property name="port" value="${port}"/>
           <spring:property name="channel" value="${channel}"/>
           <spring:property name="queueManager" value="${queueManager}"/>
           <spring:property name="SSLCipherSuite" value="${SSLCipherSuite}"/>
           <spring:property name="targetClientMatching" value="true" />
           <spring:property name="transportType" value="1" />
        </spring:bean>
  1. 创建 UserCredentialsConnectionFactoryAdapter bean 并将上面创建的 bean 作为对此的引用。
<spring:bean id="jmsQueueConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <spring:property name="targetConnectionFactory" ref="MQConnectionFactory" />
        <spring:property name="username" value="${username}" />
        <spring:property name="password" value="${password}" />
    </spring:bean>
  1. 创建 WMQ 连接器并传递适当的引用和值
<wmq:connector name="WMQConnector" 
              hostName="${hostName}" 
              port="${port}" 
              queueManager="${queueManager}" 
              channel="${channel}" 
              transportType="CLIENT_MQ_TCPIP" 
              validateConnections="true"  
              doc:name="WMQ" 
              password="${password}" 
              username="${username}"  
              dynamicNotification="true" 
              numberOfConsumers="1" 
              connectionFactory-ref="MQConnectionFactory" 
              cacheJmsSessions="false"  
              specification="1.1" 
              targetClient="JMS_COMPLIANT" 
              acknowledgementMode="CLIENT_ACKNOWLEDGE" 
              maxRedelivery="-1">

  1. 在 VM 参数中设置密钥库和信任库位置和密码,如下所示
-Djavax.net.ssl.trustStore=keystore.jks -Djavax.net.ssl.trustStorePassword=xxxx -Djavax.net.ssl.keyStore=keystore.jks -Djavax.net.ssl.keyStorePassword=xxxx

而已。这应该通过 Mule 中的 SSL 集成来解决 WMQ。

于 2018-01-11T18:08:47.810 回答