The Dart SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Dart - queue()
Creates a new Queue to process asynchronous messages.
import 'package:nitric_sdk/nitric.dart';
final batchQueue = Nitric.queue("batch").allow([
QueuePermission.enqueue,
QueuePermission.dequeue,
]);
Parameters
- Name
name
- Required
- Required
- Type
- String
- Description
The unique name of this Queue within the service. Subsequent calls to
queue
with the same name will return the same object.
Access
All Nitric resources provide access permissions you can use to specify the level of access your service needs to the resource. See here for details Access Control documentation.
Available permissions:
QueuePermission.enqueue
This permission allows your service to enqueue new messages.
QueuePermission.dequeue
This permission allows your service to dequeue messages and complete them.
Notes
In most instances, code should either enqueue or dequeue from a queue, usually not both.
Examples
Create a Queue
import 'package:nitric_sdk/nitric.dart';
final batchQueue = Nitric.queue("batch").allow([
QueuePermission.enqueue,
QueuePermission.dequeue,
]);
Enqueue messages
import 'package:nitric_sdk/nitric.dart';
final batchQueue = Nitric.queue("batch").allow([
QueuePermission.enqueue,
QueuePermission.dequeue,
]);
final messages = []
await batchQueue.enqueue(messages);