更新已弃用的WAS-MQ代码

时间:2013-04-09 05:07:21

标签: java ibm-mq deprecated

我正在努力将基于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的文档没什么帮助。

  3. 感谢您更换弃用语句的任何帮助。

1 个答案:

答案 0 :(得分:0)

这意味着您需要创建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