Creating a z/OS Connect service at run time

To process incoming requests, you can create a z/OS connect service at run time by using the com.ibm.wsspi.zos.connect.ServiceController service programming interface (SPI).

About this task

You can dynamically create a z/OS Connect service provider at run time based on the configuration that is stored in an external repository.

Procedure

  1. Create a service provider that implements the z/OS Connect com.ibm.wsspi.zos.connect.ServiceController SPI.
  2. At run time, register the service with the OSGi framework that is using the theregisterService method on the BundleContext attribute.
    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);
    Important: The Java API documentation for each Liberty SPI is detailed in the Programming Interfaces (APIs) section of the documentation, and is also available as a separate .zip file in one of the subdirectories of the ${wlp.install.dir}/dev directory. For more information, see the documentation on extending Liberty.

Icon that indicates the type of topic Task topic

File name: twlp_zconnect_create_serv_runtime.html