useNamespace method

void useNamespace(
  1. String? namespace
)

Puts every queue this process dispatches to, works, lists or flushes under namespace, as <namespace>.<queue>. Null for none.

In a preview, read from DARTVEL_QUEUE_NAMESPACE when nothing set it, which is what a preview deployment writes, and ignored in every other environment: a preview on production's broker would otherwise reserve from production's default queue and run production's jobs against a seeded database, and nothing would throw. Applied here rather than in each adapter, so an adapter added later cannot forget it.

A process in a preview with no namespace uses no queue at all, and a process with no namespace cannot name a preview's queue.

Implementation

void useNamespace(String? namespace) {
  if (namespace != null) _checkNamespace(namespace);
  _namespace = namespace;
  _namespaceSettled = true;
}