Learn how to pull and process events from pull subscriptions
Pull subscriptions allow you to actively retrieve events from Sailhouse when your application is ready to process them. This pattern is particularly useful for background workers or batch processing systems.
You acknowledge the event → Event is removed from the queue
You abandon the event → Event returns to the queue immediately
Lock expires → Event returns to the front of the queue automatically
Copy
// Example of pulling and acknowledging an eventconst event = await subscription.client.pull('user-created', 'send-welcome-email');try { // Process the event await processEvent(event); // Acknowledge successful processing await event.ack();} catch (error) { // Event will automatically return to queue after lock expires console.error('Failed to process event:', error);}
If your processing takes over 30 seconds, you can configure the lock window on the subscription settings.