パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.1

dart_amqp_client

AMQP(高度メッセージキューイングプロトコル)の接続、チャネル、および関連するコールバックを簡単に扱うためのDartパッケージ。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
105
いいね数
13
Pub ポイント
145

パッケージをインストール

flutter pub add dart_amqp_client

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

AMQP(高度メッセージキューイングプロトコル)通信を簡素化するためのDartパッケージで、複数のプラットフォーム間で信頼性の高いリアルタイムメッセージングを可能にします。接続管理、チャネル処理、およびメッセージ駆動型アプリケーション向けのコールバック実行を簡単にします。チャットシステム、ライブストリーミング統合、または堅牢なキューと配信保証が必要なリアルタイムデータ交換を構築する開発者に最適です。このパッケージはAndroid、iOS、macOS、Windows、Linuxなど複数のプラットフォームをサポートしています。

用途

  • リアルタイムチャットアプリケーション
  • ライブストリーミングイベント放送
  • メッセージキュー統合
  • IoTデバイス通信
  • イベント駆動型のバックエンドサービス

主な機能

  • 簡略化された AMQP 接続処理
  • 組み込みチャネル管理
  • 非同期コールバックのサポート
  • クロスプラットフォーム互換性
  • 堅牢なエラー処理

適している対象

  • リアルタイムアプリを開発する開発者
  • AMQPベースのメッセージングシステムを使用するチーム
  • 信頼できるメッセージ配信を必要とするプロジェクト
  • モバイルおよびデスクトップでのリアルタイム通信
  • IoTとバックエンドサービスの統合

注意事項

  • AMQP ブローカー(例:RabbitMQ)が必要です
  • 成熟した代替品と比べてドキュメントが限られている
  • 高スループットのシナリオに最適化されていません
  • 外部ブローカーの利用可能性に依存します
  • 本番環境での使用には追加の設定が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Dart AMQP Client

Dart AMQP Client is a Dart package that simplifies the handling of AMQP (Advanced Message Queuing Protocol) connections, channels, and associated callbacks.

Features

Connection Management: Automatically handles AMQP connection establishment and reconnection. Callback Support: Define custom callbacks for connection events, such as when the connection is established or encounters an error. Reconnection Control: Configure the maximum number of reconnection attempts for robust AMQP connections. Simple Integration: Easily integrate the package into your Dart applications with a straightforward API.

Table of Contents

Installation

To use this package, add dart_amqp_client as a dependency in your pubspec.yaml file:

dependencies: dart_amqp_client: ^1.0.1

Then, run pub get to fetch and install the package.

Quick start

import 'package:dart_amqp_client/dart_amqp_client.dart';

void main() {
  // Create a ConnectionSettings instance with your AMQP server details.
  ConnectionSettings connectionSettings = ConnectionSettings(
    host: 'localhost',
    port: 5672,
    maxConnectionAttempts: 5, // Set the maximum connection attempts
  );

  // Create an instance of the AMQP service.
  AmqpService(connectionSettings);

  // Set callback functions for connection events.
  AmqpService.onConnected(() {
    print('Connected to AMQP server.');
    // Use the service to establish an AMQP connection.
    Client client = AmqpService.getClient();

    // ... Perform AMQP operations with the client and channel ...

    String consumeTag = "hello";
    String msg = "Hello World!";

    client.channel().then((Channel channel) {
      return channel.queue(consumeTag, durable: false);
    }).then((Queue queue) {
      queue.publish(msg);
      print(" [x] Sent $msg");
      client.close();
    });

    String queueTag = "hello";
    Channel? channel = AmqpService.getChannel();
    channel!.queue(queueTag, durable: false).then((Queue queue) {
      print(" [*] Waiting for messages in $queueTag. To Exit press CTRL+C");
      return queue.consume(consumerTag: queueTag, noAck: true);
    }).then((Consumer consumer) {
      consumer.listen((AmqpMessage event) {
        print(" [x] Received ${event.payloadAsString}");
      });
    });
  });

  AmqpService.onDisconnected(() {
    print('Disconnected from AMQP server.');
  });

  AmqpService.onError((Exception error) {
    print('An error occurred: $error');
  });
}

Examples

The [example] folder contains implementations for getting started

Contributing

Feel free to contribute

License

dart_amqp is distributed under the [MIT license]

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。