Updated on 2023-11-30 GMT+08:00

Overview

DMS TCP SDK

Distributed Message Service (DMS) TCP Software Development Kit (SDK) provides TCP-based application programming interfaces (APIs). Third-party applications can call DMS TCP SDK APIs to produce, consume, and acknowledge messages. Table 1 describes the APIs provided by DMS for third-party applications to call. For details about the APIs, see the corresponding API reference document.

Table 1 DMS TCP SDK APIs

API

Description

Type

Message production API

Sends messages to DMS queues.

Synchronous, asynchronous, and one-way

Message consumption API

Retrieves messages from DMS queues.

Synchronous and asynchronous

Message acknowledgment API

Acknowledges that messages are successfully retrieved from DMS queues.

Synchronous and asynchronous

  • After an asynchronous or one-way API is called, the process calling this API exits immediately. This may cause incomplete message delivery.
  • If a one-way API is called, the client does not receive responses (including error messages) from the server.
  • DMS does not support "exactly once" message delivery. If a message is displayed indicating that the operation has failed, there is a low possibility that the operation has actually succeeded. DMS provides "at-least-once" message delivery. To avoid any adverse effects from processing the same message multiple times, ensure your application (consumer) processes messages idempotently.

Features

  • Message redelivery

    The DMS TCP SDK supports message redelivery. If a message fails to be retrieved, it can be flagged as redelivery and dumped to the message queue. Consumers can retrieve the message later. Messages can be retrieved at least 30 seconds after being redelivered. When you acknowledge message retrieval, you can choose to flag messages as success, failure, or redelivery.

  • Message broadcasting

    All consumers in a consumer group can consume the same message.

    You can configure whether to automatically acknowledge message consumption.

    Consumers can choose any of the following message consumption modes:

    • Multicast: After a message is successfully consumed, other consumers in the same consumer group can no longer consume the message.
    • Broadcast from the earliest message: All consumers in a consumer group can consume the first message and subsequent messages in the queue.
    • Broadcast from the previous consumption position: If a fixed Consumer id is set, all consumers in a consumer group can consume all the messages that are never consumed in the queue from the specified retrieval position.
    • Broadcast from the latest message: All consumers in a consumer group can consume new incoming messages in the queue.
  • Generally, the DMS TCP SDK can process thousands of messages per second. If more messages need to be processed per second, submit a work order or contact the customer service.

Development Process

The Java language is used as an example to describe how to perform secondary development based on DMS TCP SDK.

The development process is as follows:

Figure 1 Development process