Search packages, repositories and app categories

Package detailsv1.0.1

dart_amqp_client

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

AndroidiOSmacOSWindowsLinux
30-day downloads
105
Likes
13
Pub points
145

Install package

flutter pub add dart_amqp_client

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Dart package designed to streamline AMQP (Advanced Message Queuing Protocol) communication, enabling reliable real-time messaging across platforms. It simplifies connection management, channel handling, and callback execution for message-driven applications. Ideal for developers building chat systems, live streaming integrations, or any real-time data exchange requiring robust queuing and delivery guarantees. The package supports multiple platforms including Android, iOS, macOS, Windows, and Linux.

Use cases

  • Real-time chat applications
  • Live streaming event broadcasting
  • Message queue integration
  • IoT device communication
  • Event-driven backend services

Key features

  • Simplified AMQP connection handling
  • Built-in channel management
  • Asynchronous callback support
  • Cross-platform compatibility
  • Robust error handling

Suitable for

  • Developers building real-time apps
  • Teams using AMQP-based messaging systems
  • Projects requiring reliable message delivery
  • Mobile and desktop real-time communication
  • IoT and backend service integration

Considerations

  • Requires an AMQP broker (e.g., RabbitMQ)
  • Limited documentation compared to mature alternatives
  • Not optimized for high-throughput scenarios
  • Depends on external broker availability
  • May need additional configuration for production use

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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]

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.