Creating a topic

Create a topic before creating bucket notifications.

A topic is a Simple Notification Service (SNS) entity and all the topic operations, that is, create, delete, list, and get, are SNS operations. The topic needs to have endpoint parameters that are used when a bucket notification is created. Once the request is successful, the response includes the topic Amazon Resource Name (ARN) that can be used later to reference this topic in the bucket notification request.
Note: A topic_arn provides the bucket notification configuration and is generated after a topic is created.

Prerequisites

  • A running IBM Storage Ceph cluster.

  • Root-level access.

  • Installation of the Ceph Object Gateway.

  • User access key and secret key.

  • Endpoint parameters.

  1. Create a topic with the following request format:

    Syntax

    POST
    Action=CreateTopic
    &Name=TOPIC_NAME
    [&Attributes.entry.1.key=amqp-exchange&Attributes.entry.1.value=EXCHANGE]
    [&Attributes.entry.2.key=amqp-ack-level&Attributes.entry.2.value=none|broker|routable]
    [&Attributes.entry.3.key=verify-ssl&Attributes.entry.3.value=true|false]
    [&Attributes.entry.4.key=kafka-ack-level&Attributes.entry.4.value=none|broker]
    [&Attributes.entry.5.key=use-ssl&Attributes.entry.5.value=true|false]
    [&Attributes.entry.6.key=ca-location&Attributes.entry.6.value=FILE_PATH]
    [&Attributes.entry.7.key=OpaqueData&Attributes.entry.7.value=OPAQUE_DATA]
    [&Attributes.entry.8.key=push-endpoint&Attributes.entry.8.value=ENDPOINT]
    [&Attributes.entry.9.key=persistent&Attributes.entry.9.value=true|false]

    Here are the request parameters:

    • Endpoint: URL of an endpoint to send notifications to.

    • OpaqueData: opaque data is set in the topic configuration and added to all notifications triggered by the topic.

    • persistent: indication of whether notifications to this endpoint are persistent that is asynchronous or not. By default the value is false.

    • HTTP endpoint:

      • URL: https://FQDN:PORT

      • port defaults to: Use 80/443 for HTTP[S] accordingly.

      • verify-ssl: Indicates whether the server certificate is validated by the client or not. By default , it is true.

    • AMQP0.9.1 endpoint:

      • URL: amqp://USER:PASSWORD@FQDN:PORT[/VHOST].

      • User and password defaults to: guest and guest respectively.

      • User and password details should be provided over HTTPS, otherwise the topic creation request is rejected.

      • port defaults to: 5672.

      • vhost defaults to: “/”

      • amqp-exchange: The exchanges must exist and be able to route messages based on topics. This is a mandatory parameter for AMQP0.9.1. Different topics pointing to the same endpoint must use the same exchange.

      • amqp-ack-level: No end to end acknowledgment is required, as messages may persist in the broker before being delivered into their final destination. Three acknowledgment methods exist:

        • none: Message is considered delivered if sent to the broker.

        • broker: By default, the message is considered delivered if acknowledged by the broker.

        • routable: Message is considered delivered if the broker can route to a consumer.
          Note:
          • The key and value of a specific parameter do not have to reside in the same line, or in any specific order, but must use the same index. Attribute indexing does not need to be sequential or start from any specific value.
          • The topic-name is used for the AMQP topic.
    • Kafka endpoint:

      • URL: kafka:USER:PASSWORD@FQDN:PORT.

      • use-ssl is set to false by default. If use-ssl is set to true, secure connection is used for connecting with the broker.

      • If ca-location is provided, and secure connection is used, the specified CA will be used, instead of the default one, to authenticate the broker.

      • User and password can only be provided over HTTP[S]. Otherwise, the topic creation request is rejected.

      • User and password may only be provided together with use-ssl, otherwise, the connection to the broker will fail.

      • port defaults to: 9092.

      • kafka-ack-level: no end to end acknowledgment required, as messages may persist in the broker before being delivered into their final destination. Two acknowledgment methods exist:

        • none: message is considered delivered if sent to the broker.

        • broker: By default, the message is considered delivered if acknowledged by the broker.

The following is an example of the response format:

Example

<CreateTopicResponse xmlns="https://sns.amazonaws.com/doc/2010-03-31/">
    <CreateTopicResult>
        <TopicArn></TopicArn>
    </CreateTopicResult>
    <ResponseMetadata>
        <RequestId></RequestId>
    </ResponseMetadata>
</CreateTopicResponse>
Note: The topic Amazon Resource Name (ARN) in the response will have the following format: arn:aws:sns:ZONE_GROUP:TENANT:TOPIC

The following is an example of AMQP0.9.1 endpoint:

Example

client.create_topic(Name='my-topic' , Attributes={'push-endpoint': 'amqp://127.0.0.1:5672', 'amqp-exchange': 'ex1', 'amqp-ack-level': 'broker'}) "