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 about infrastructure security.
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);
Last updated on Nov 14, 2024