패키지, 저장소 및 앱 카테고리 검색

패키지 상세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를 포함한 여러 플랫폼을 지원합니다.

사용 사례

  • 실시간 채팅 애플리케이션
  • 라이브 스트리밍 이벤트 방송
  • 메시지 큐 통합
  • 사물인터넷 장치 통신
  • 이벤트 기반 백엔드 서비스

주요 기능

  • 간소화된 AMQP 연결 처리
  • 내장 채널 관리
  • 비동기 콜백 지원
  • 크로스 플랫폼 호환성
  • 강력한 오류 처리

적합한 대상

  • 실시간 앱을 개발하는 개발자
  • AMQP 기반 메시징 시스템을 사용하는 팀
  • 신뢰할 수 있는 메시지 전달이 필요한 프로젝트
  • 모바일 및 데스크톱 실시간 통신
  • 사물인터넷 및 백엔드 서비스 통합

고려 사항

  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.