Skip to content

Commit eb031e5

Browse files
committed
docs: update worker example
1 parent a5fb860 commit eb031e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

_example/worker/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ func main() {
3030

3131
// define the worker
3232
w := rabbitmq.NewWorker(
33-
rabbitmq.WithSubj("sample_1"),
33+
rabbitmq.WithSubj("sample_worker"),
34+
rabbitmq.WithExchangeName("sample_worker"),
35+
rabbitmq.WithRoutingKey("sample_worker"),
3436
rabbitmq.WithRunFunc(func(ctx context.Context, m core.QueuedMessage) error {
3537
var v *job
3638
if err := json.Unmarshal(m.Bytes(), &v); err != nil {
@@ -43,7 +45,7 @@ func main() {
4345

4446
// define the queue
4547
q, err := queue.NewQueue(
46-
queue.WithWorkerCount(10),
48+
queue.WithWorkerCount(5),
4749
queue.WithWorker(w),
4850
)
4951
if err != nil {

rabbitmq_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ func TestGoroutinePanic(t *testing.T) {
217217
}
218218
w := NewWorker(
219219
WithSubj("GoroutinePanic"),
220+
WithRoutingKey("GoroutinePanic"),
221+
WithExchangeName("GoroutinePanic"),
220222
WithRunFunc(func(ctx context.Context, m core.QueuedMessage) error {
221223
panic("missing something")
222224
}),

0 commit comments

Comments
 (0)