-
Notifications
You must be signed in to change notification settings - Fork 40
/
exchange.dart
80 lines (73 loc) · 3.39 KB
/
exchange.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
part of "../client.dart";
abstract class Exchange {
/// Get the name of the exchange
String get name;
/// Get the type of the exchange
ExchangeType get type;
/// Get the [Channel] where this exchange was declared
Channel get channel;
/// Delete the exchange and return a [Future<Exchange>] to the deleted exchange.
///
/// If the [ifUnsused] flag is set, the server will only delete the exchange if it has no queue-bindings. If the
/// flag is set and the exchange has any queue bindings left, then the server will raise an exception.
Future<Exchange> delete({bool ifUnused = false, bool noWait = false});
/// Publish [message] to the exchange. [message] should be either a [Uint8List], a [String], a [Map] or [Iterable].
/// If [message] is [Map] or [Iterable] it will be encoded as JSON and the appropriate message properties
/// (content-type and content-encoding) will be set on the outgoing message. Any other [message] value will
/// trigger an [ArgumentError].
///
/// You may specify additional message properties by setting the [properties] named parameter.
///
/// If the [mandatory] flag is set, the server will return un-routable messages back to the client. Otherwise
/// the server will drop un-routable messages.
///
/// if the [immediate] flag is set, the server will immediately return undeliverable messages to the client
/// if it cannot route them. If the flag is set to false, the server will queue the message even though
/// there is no guarantee that it will ever be consumed.
void publish(Object message, String? routingKey,
{MessageProperties properties,
bool mandatory = false,
bool immediate = false});
/// Allocate a private [Queue], bind it to this exchange using the supplied [routingKeys],
/// allocate a [Consumer] and return a [Future<Consumer>].
///
/// You may specify a [consumerTag] to label this consumer. If left unspecified, the server will assign a
/// random tag to this consumer. Consumer tags are local to the current channel.
///
/// The [noAck] flag will notify the server whether the consumer is expected to acknowledge incoming
/// messages or not.
///
/// The [noWait] and [arguments] parameters are used in the same way
/// as they are in [Channel.privateQueue].
Future<Consumer> bindPrivateQueueConsumer(
List<String>? routingKeys, {
String consumerTag,
bool noAck = true,
bool noWait = false,
Map<String, Object>? arguments,
});
/// Allocate a named [Queue], bind it to this exchange using the supplied [routingKeys],
/// allocate a [Consumer] and return a [Future<Consumer>].
///
/// You may specify a queue name and a [consumerTag] to label this consumer. If left unspecified,
/// the server will assign a random tag to this consumer. Consumer tags are local to the current channel.
///
/// The [noAck] flag will notify the server whether the consumer is expected to acknowledge incoming
/// messages or not.
///
/// The [passive], [durable], [exclusive], [autoDelete], [noWait] and
/// [declare] parameters are used in the same way as they are in
/// [Channel.queue].
Future<Consumer> bindQueueConsumer(
String queueName,
List<String> routingKeys, {
String consumerTag,
bool noAck = true,
bool passive = false,
bool durable = false,
bool exclusive = false,
bool autoDelete = false,
bool noWait = false,
bool declare = true,
});
}