Mulesoft 中带有 SSL 的 WebMQ

WebMQ with SSL in Mulesoft

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

Root Exception was: MQJE001: An MQException occurred: Completion Code 2, Reason 2009 MQJE016: MQ queue manager closed channel immediately during connect Closure reason = 2009. Type: class com.ibm.mqservices.MQInternalException

我在 google 上搜索时没有遇到任何带有 TLS 的 WMQ 示例代码。非常感谢任何clues/insights。

提前致谢!

  1. Create MQQueueConnectionFactory bean as below
<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. Create UserCredentialsConnectionFactoryAdapter bean and pass above created bean as reference to this.
<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. Create WMQ connector and pass the appropriate references and values
<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. Set keystore and truststore locations and passwords in VM arguments as below
-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。