This is a prerelease version.

View latest

Member Configuration

User Code Namespaces are referenced by name, and can be statically configured in the Hazelcast configuration file. You can specify JAR, JARS IN ZIP, and CLASS resources in the configuration file.

To configure User Code Namespaces using the hazelcast configuration file, in either XML or YAML format, complete the following steps:

  1. If not already open, open the hazelcast configuration file in your preferred editor and scroll to the User Code Namespaces section

  2. If required, add a class-filter to verify classes when loaded into the class loader during namespace deployment

    An example class filter is included in the sample below. For further information on the configuration of the class-filter, see the Configuring Serializers topic.

  3. Define the name of the namespace under the line in which you enabled User Code Namespaces, as follows:

    • XML

    • YAML

    <user-code-namespaces enabled="true">
        <class-filter defaults-disabled="true">
        <namespace name="myNameSpace">
       enabled: true
          defaults-disabled: true
              - example.Foo
              - com.hazelcast.
              - java.
              - javax.
              - \[
       myNameSpace: []
  4. Define the resources

    To define a resource, you must provide the resource type, and the location (URL) in which the resource can be found. You can also provide an identifier for the resource. If you do not provide an identifier, the specified URL is used.

    You can define multiple User Code Namespaces, if required, by repeating steps 3 and 4 for your other namespaces.

    The resource type can be JAR (jar), JARS_IN_ZIP (jars-in-zip), or CLASS ('class'); the following extract provides examples for these resource types:

    • XML

    • YAML

    <user-code-namespaces enabled="true">
        <namespace name="myNameSpace">
            <jar id="jarID">
            <jars-in-zip id="MyJARsInZIPFileID">
            <class id="classId">
       enabled: true
        - id: jarID
          resource-type: JAR
          url: "file:///yoursrc/class/usercodedeployment/MyJarFile.jar"
        - id: MyJARsInZIPFileID
          resource-type: JARS_IN_ZIP
          url: "file:///yoursrc/class/usercodedeployment/"
        - id: classId
          resource-type: CLASS
          url: "file:///yoursrc/class/usercodedeployment/MyClass.class"
  5. Save the file

Before you can use these namespaces, you must update your data structure configuration to identify the namespace it will use. For further information on configuring the namespace used by your data structure, see the Data Structures topic.

You can configure the default namespace as a fallback for situations where the data structure does not have a defined namespace. For further information on configuring the default namespace, see the Non-associated Namespaces topic.