gpt4 book ai didi

java - Mulesoft 中使用 SSL 的 WebMQ

转载 作者:行者123 更新时间:2023-11-30 06:22:00 25 4
gpt4 key购买 nike

我是 Mulesoft Anypoint Studio 的新手,刚刚开始探索它。我的流程从从 MQ 读取消息开始,到将其放置在目的地结束,从我的本地计算机开始,稍后会发展。我遇到了一个问题,队列有 TSL,涉及 keystore 和信任库。现在,在 Anypoint 中我看到 WMQ 和 HTTPS/TSL 连接器。我已将 TSL 上下文设置为全局元素,但如何将其设置为 WMQ 连接器的一部分?可以通过具有正确 TLS 设置( keystore 、信任库等)的 Java 代码访问相同的队列和/或 channel ,但在 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 示例代码。非常感谢任何线索/见解。

提前谢谢您!

最佳答案

  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 中 WMQ 与 SSL 集成的问题。

关于java - Mulesoft 中使用 SSL 的 WebMQ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47935332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com