Queuing | laravel-slack-alerts-go | Spatie       

 SPATIE  

laravel-slack-alerts-go
=======================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-slack-alerts-go](https://spatie.be/docs/laravel-slack-alerts-go/v1)  Queuing

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-slack-alerts-go/v1) 

  Queuing    
- [ Introduction ](https://spatie.be/docs/laravel-slack-alerts-go/v1/introduction)
- [ Installation ](https://spatie.be/docs/laravel-slack-alerts-go/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-slack-alerts-go/v1/usage)
- [ Sending blocks ](https://spatie.be/docs/laravel-slack-alerts-go/v1/sending-blocks)
- [ Using multiple webhooks ](https://spatie.be/docs/laravel-slack-alerts-go/v1/using-multiple-webhooks)
- [ Queuing ](https://spatie.be/docs/laravel-slack-alerts-go/v1/queuing)
- [ Formatting ](https://spatie.be/docs/laravel-slack-alerts-go/v1/formatting)
- [ Testing ](https://spatie.be/docs/laravel-slack-alerts-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-slack-alerts-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-slack-alerts-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-slack-alerts-go/v1/support-us)

 Queuing
=======

By default, messages are dispatched to the `default` queue on Laravel's configured queue connection. Configure a durable connection and run `laravel queue:work` in production. Database queues need the application's queue tables created with `queue.CreateTables` in a migration.

### Configuring the queue

```
SLACK_ALERT_QUEUE=queue_name
```

### Changing the queue at runtime

```
err := slackalerts.From(ctx).OnQueue("some-queue").Message(ctx, "Some message.")
```

### Customizing the job

Embed the default job to change timeouts, retries or delivery behavior. Select the replacement through `Config.Job`. The package registers the returned concrete type with Laravel, so the same job runs after queue serialization.

```
type SendAlert struct {
    slackalerts.SendToSlackChannelJob
}

func (SendAlert) JobOptions() queue.Options {
    return queue.Options{Tries: 5, Timeout: 10 * time.Second}
}

// In bootstrap/app.go
slackalerts.New(func(cfg *slackalerts.Config) {
    cfg.Job = func(job slackalerts.SendToSlackChannelJob) slackalerts.Job {
        return SendAlert{SendToSlackChannelJob: job}
    }
})
```

Import `go.laravel.com/queue` and `time` for this example. The factory must return the same serializable concrete type every time, including for an empty payload during registration. Jobs must not carry closures or live connections.

The default job allows three attempts and at most three errors. Unlike PHP's unlimited attempts with a three-exception limit, Laravel Go uses an explicit attempt limit. HTTP failures return errors for the worker to retry. Retrying a webhook can deliver duplicates if Slack accepted a request before the connection failed.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
