在執行時期建立 z/OS Connect 服務

若要處理送入的要求,您可以在執行時期使用 com.ibm.wsspi.zos.connect.ServiceController 服務程式設計介面 (SPI),來建立 z/OS Connect 服務。

關於這項作業

您可以在執行時期,根據儲存在外部儲存庫中的配置,動態建立 z/OS Connect 服務提供者。

程序

  1. 建立一個實作 z/OS Connect com.ibm.wsspi.zos.connect.ServiceController SPI 的服務提供者。
  2. 在執行時期,向會在 BundleContext 屬性中使用 theregisterService 方法的 OSGi 架構,登錄該服務。
    Dictionary<String, Object> dynamicServiceProps = new Hashtable<String, Object>();
    dynamicServiceProps.put(ServiceControllerConstants.SERVICE_NAME, "myNewService");
    dynamicServiceProps.put(ServiceControllerConstants.INVOKE_URI, new String[] { "/u/my/url1",
          "/u/myurl2", "/u/my/url3*" });
    ServiceRegistration<ServiceController> dynamicServiceReg =
          bundleContext.registerService(com.ibm.wsspi.zos.connect.ServiceController.class, new
    MyServiceController(), dynamicServiceProps);
    重要: 每一個 Liberty SPI 的 Java API 說明文件,詳述於說明文件中的「程式設計介面 (API)」區段,此外也可在個別的 .zip 檔中找到,該檔案位於 ${wlp.install.dir}/dev 目錄的其中一個子目錄中。如需相關資訊,請參閱延伸 Liberty 的相關說明文件。

指示主題類型的圖示 作業主題

檔名:twlp_zconnect_create_serv_runtime.html