From 46e39770a14c5e8df6e2e12d3d74ffbe817a42c4 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Thu, 26 Oct 2023 10:41:30 -0400 Subject: [PATCH] Replace deprecated Publish method with PublishWithContext --- ees/amqp.go | 3 ++- ers/amqp_it_test.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ees/amqp.go b/ees/amqp.go index 9ac594bfe..ea35bcff5 100644 --- a/ees/amqp.go +++ b/ees/amqp.go @@ -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 diff --git a/ers/amqp_it_test.go b/ers/amqp_it_test.go index 282547eff..3ba4c0ba3 100644 --- a/ers/amqp_it_test.go +++ b/ers/amqp_it_test.go @@ -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