Replace deprecated Publish method with PublishWithContext

This commit is contained in:
ionutboangiu
2023-10-26 09:33:31 -04:00
committed by Dan Christian Bogos
parent c4e0d92a2a
commit d1d43913c8
2 changed files with 6 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package ees
import (
"context"
"fmt"
"sync"
@@ -146,7 +147,8 @@ func (pstr *AMQPee) ExportEvent(content any, _ string) (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

@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package ers
import (
"context"
"fmt"
"reflect"
"testing"
@@ -93,7 +94,8 @@ func TestAMQPER(t *testing.T) {
rdr.Serve()
randomCGRID := utils.UUIDSha1Prefix()
if err = channel.Publish(
if err = channel.PublishWithContext(
context.TODO(),
"test-exchange", // publish to an exchange
"test-key", // routing to 0 or more queues
false, // mandatory