Creating and updating a message hub by using REST Administration APIs

System administrators can create and update endpoints, connection policies, messaging policy types, and message hubs by using REST Administration APIs.

You can create a message hub or update an existing message hub by using a REST Administration API, or by using the Amlen WebUI. For more information about using the Amlen WebUI to create a message hub, see Configuring message hubs by using the Amlen WebUI.

You can use the Eclipse Amlen REST API POST method to create or update one or more message hubs. If the message hub that is specified in the request does not exist in the Eclipse Amlen configuration table, then the message hub is created. Otherwise the message hub configuration is updated.

For more information about the components you must specify to create a message hub, including naming restrictions, see Configuring message hubs.

  1. To create or update a message hub, use the Eclipse Amlen REST API POST method with the following Eclipse Amlen configuration URI:

    http://<admin-endpoint-IP:Port>/ima/v1/configuration/

  2. Provide MessageHub object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json. Ensure that capitalization and double quotation marks are used as shown.
    
    {    
       "MessageHub": {
         "<NameOfMessageHub>": {
           "Description": "string"
         }
       }
    }
    Where:
    NameOfMessageHub
    Required.
    Specifies the name of the message hub.
    The name must not have leading or trailing spaces and cannot contain control characters, commas, double quotation marks, backslashes, or equal signs. The first character must not be a number or any of the following special characters:

    ! # $ % & ' ( ) * + - . / : ; < > ? @

    After the message hub is created, you cannot change this name.
    Description
    Optional.
    Specifies a description for the message hub.
    If you do not want a description, omit "Description":"description".

The following example shows a POST method to create a message hub called "MyHub" by using cURL:


curl -X POST \
   -H 'Content-Type: application/json'  \
   -d  '{  
            "MessageHub":  { 
              "MyHub":  {
                 "Description": "Message Hub to service demo clients."
               }
           }   
       }    
    '  \
http://127.0.0.1:9089/ima/v1/configuration/

The following example shows an example response to the POST method:


{        
  "Version": "v1",
  "Code": "CWLNA6011",
  "Message": "The requested configuration change has completed successfully."
}

When you create a message hub, you must also create at least one endpoint. The endpoint must have at least one connection policy, and at least one type of messaging policy. When you create the endpoint, you must specify the connection policies and types of messaging policy that are associated with the endpoint. Therefore, you must create the connection policies and messaging policy types before you create the endpoint.

You must complete the following tasks to finish the message hub configuration:
  1. Create connection policies.
  2. Create messaging policy type.
  3. Create endpoints.