시작하기 전에
이 주제를 시작하기 전에 구성 관리자 프록시를 사용하여 구성 관리자에 연결을 완료해야 합니다.
import com.ibm.broker.config.proxy.*; public class SetLongDescription { public static void main(String[] args) { ConfigManagerProxy cmp = null; try { ConfigManagerConnectionParameters cmcp = new MQConfigManagerConnectionParameters( "localhost", 1414, ""); cmp = ConfigManagerProxy.getInstance(cmcp); } catch (ConfigManagerProxyException cmpex) { System.out.println("Error connecting: "+cmpex); } if (cmp != null) { System.out.println("Connected to Config Manager!"); describeBroker(cmp, "B1", "this is my broker"); cmp.disconnect(); } } private static void describeBroker(ConfigManagerProxy cmp, String brokerName, String newDesc) { BrokerProxy b = null; try { TopologyProxy topology = cmp.getTopology(); if (topology != null) { b = topology.getBrokerByName(brokerName); } } catch(ConfigManagerProxyPropertyNotInitializedException ex) { System.err.println("Comms problem! "+ex); } if (b != null) { try { b.setLongDescription(newDesc); } catch (ConfigManagerProxyException ex) { System.err.println("Could not send request to CM: "+ex); } } else { System.err.println("Broker "+brokerName+" not found"); } } }
Properties p = new Properties(); p.setProperty(AttributeConstants.LONG_DESCRIPTION_PROPERTY, newDesc); b.setProperties(p);
현재 사용자가 필요한 권한을 보유하지 않는 경우 SetLongDescription.java가 작동될 때 요청을 구성 관리자에서 거부하는지 판별할 수 없다는 점에 유의하십시오. 조작 수행 메시지가 구성 관리자로 송신될 수 없는 경우 자세한 설명 필드를 설정하는 CMP 메소드에 따라 ConfigManagerProxyException이 전달됩니다. 이는 구성 관리자가 필요한 등록 정보를 변경할 수 없더라도 프로그램 출력이 정확히 동일하다는 것을 의미합니다.
이유는 구성 관리자가 CMP 요청을 비동기 방식으로 처리하여 구성 관리자에서 조치가 수행될 때까지 이론적으로 상당한 시간이 소요될 수 있기 때문입니다. 이 토픽 내에 설명된 것과 같은 메소드가 완료 코드의 사용 가능 시점까지 제어를 프로그램으로 리턴하지 않은 경우 CMP 응용프로그램의 성능은 구성 관리자의 성능에 전적으로 좌우됩니다.
다음:
따라서 대부분의 상태 변경 CMP 메소드가 호출 응용프로그램에 요청 결과를 알리지 않고 즉시 리턴하도록 설계되어 있습니다. 이 정보를 찾으려면 구성 관리자 프록시를 사용한 도메인 관리의 결과 점검을 참조하십시오.