     _wm         bigint;
     wm_consumer text;
 begin
+    wm_consumer = '.global_watermark';
+
     select node_type, queue_name, worker_name into this
         from pgq_node.node_info
         where queue_name = i_queue_name
         for update;
     if not found then
-        select 200, 'Queue' || i_queue_name || ' not found'
+        select 404, 'Queue' || i_queue_name || ' not found'
           into ret_code, ret_note;
         return;
     end if;

            set last_tick_id = _wm
            where queue_name = i_queue_name
                and consumer_name = this.worker_name;
    end if;

    select 200, 'Global watermark set to ' || _wm

                into ret_code, ret_note;
            return;
        end if;

        -- move watermark
        perform pgq.register_consumer_at(i_queue_name, wm_consumer, _wm);

        -- send event downstream
        perform pgq.insert_event(i_queue_name, 'pgq.global-watermark', _wm::text,
                                 i_queue_name, null, null, null);
