Replace deprecated Publish method with PublishWithContext

This commit is contained in:
ionutboangiu
2023-10-26 10:41:30 -04:00
committed by Dan Christian Bogos
parent 7fd7167aa5
commit 46e39770a1
2 changed files with 5 additions and 2 deletions

View File

@@ -145,7 +145,8 @@ func (pstr *AMQPee) ExportEvent(_ *context.Context, content, _ any) (err error)
pstr.reqs.done()
return utils.ErrDisconnected
}
err = pstr.postChan.Publish(
err = pstr.postChan.PublishWithContext(
context.TODO(),
pstr.exchange, // exchange
pstr.routingKey, // routing key
false, // mandatory

View File

@@ -27,6 +27,7 @@ import (
"testing"
"time"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
@@ -91,7 +92,8 @@ func TestAMQPER(t *testing.T) {
rdr.Serve()
randomOriginID := utils.UUIDSha1Prefix()
if err = channel.Publish(
if err = channel.PublishWithContext(
context.Background(),
"test-exchange", // publish to an exchange
"test-key", // routing to 0 or more queues
false, // mandatory