Function createSupaworker

  • Create a new worker to work on a queue.

    Type Parameters

    • Payload = unknown

    Parameters

    Returns {
        client: SupabaseClient<
            Database,
            "supaworker",
            {
                CompositeTypes: {};
                Enums: {};
                Functions: {
                    dequeue: {
                        Args: { queue_name: string };
                        Returns: {
                            attempts: number;
                            created_at: string;
                            enabled: boolean;
                            id: number;
                            options: Json;
                            payload: Json;
                            queue: string;
                        }[];
                    };
                };
                Tables: {
                    jobs: {
                        Insert: {
                            attempts?: number;
                            created_at?: string;
                            enabled?: boolean;
                            id?: number;
                            options?: Json;
                            payload?: Json;
                            queue: string;
                        };
                        Relationships: [];
                        Row: {
                            attempts: number;
                            created_at: string;
                            enabled: boolean;
                            id: number;
                            options: Json;
                            payload: Json;
                            queue: string;
                        };
                        Update: {
                            attempts?: number;
                            created_at?: string;
                            enabled?: boolean;
                            id?: number;
                            options?: Json;
                            payload?: Json;
                            queue?: string;
                        };
                    };
                    logs: {
                        Insert: {
                            created_at?: string;
                            id?: string;
                            job: Json;
                            status: string;
                        };
                        Relationships: [];
                        Row: { created_at: string; id: string; job: Json; status: string };
                        Update: {
                            created_at?: string;
                            id?: string;
                            job?: Json;
                            status?: string;
                        };
                    };
                };
                Views: {};
            },
        >;
        enqueue: EnqueueFunction<Payload>;
        worker: Supaworker<Payload>;
    }

    The client, enqueue function, and worker.