【问题标题】:Updating deprecated WAS-MQ code更新已弃用的 WAS-MQ 代码
【发布时间】:2013-04-09 23:32:20
【问题描述】:

我正在将基于 WAS 6.1 的应用程序迁移到 WAS 7.0 我发现下面两条语句

com.ibm.mq.MQEnvironment.securityExit = null; // 1

MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP); // 2
  1. 在线#1 securityExitdeprecated 文档说:

    The security exit used when connecting to a queue manager. It allows you to customise the security flows that occur when an attempt is made to connect to a queue manager. If you want to provide your own security exit, define a class that implements the MQSecurityExit interface and assign securityExit to an instance of that class. If you set this field to null no security exit is called.

    据我了解,com.ibm.mq.MQSecurityExit 接口需要实现。 将 securityExit 分配给该类的实例是什么意思?

  2. 在线#2 JMSCdeprecated。医生说:

    This parameter can be passed to MQConnectionFactory.setTransportType(int) to indicate that the application should connect to the queue manager in client TCP/IP mode.

    对于文档说的界面也是:

    Use the constants defined in the classes in the com.ibm.mq.constants package instead

    com.ibm.mq.constants 的文档没有多大帮助。

感谢您在替换已弃用的语句方面的任何帮助。

【问题讨论】:

    标签: java ibm-mq deprecated


    【解决方案1】:

    这意味着您需要创建 MQSecurityExit 类的实现实例并设置安全出口属性。像这样的

       // in MySecurityExit.java
       class MySecurityExit implements MQSecurityExit 
       {
           // you must provide an implementation of the securityExit method
           public byte[] securityExit(MQChannelExit       channelExitParms,
                                      MQChannelDefinition channelDefinition,
                                      byte[]              agentBuffer)
           {
               // your exit code goes here...
           }
       }
    
       // in your main program...
       MQEnvironment.securityExit = new MySecurityExit();
       ...    // other initialisation
       MQQueueManager qMgr        = new MQQueueManager("");
    

    setTransportType 方法确定您的应用程序如何连接到 WMQ 队列管理器,应用程序和队列管理器是否通过共享内存或套接字或 HTTP 等进行通信。此方法的可能值定义为 here

    【讨论】:

    • 1. // your exit code goes here... 应该怎么做才能使代码的行为类似于 com.ibm.mq.MQEnvironment.securityExit = null; ? 2. 您将我指向已弃用的JMSC 页面
    • com.ibm.mq.MQEnvironment.securityExit=null 表示您不使用任何安全出口。那么你根本不需要实现任何安全退出,更不用说在“//你的退出代码在这里”中添加任何东西。
    • 对于 setTransportType,您可以使用未弃用的 WMQConstantsfactory.setTransportType(WMQConstants.WMQ_CM_DIRECT_TCPIP);
    猜你喜欢
    • 2012-01-24
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多