diff --git a/pkg/storage/rabbitmq/rabbitmq.go b/pkg/storage/rabbitmq/rabbitmq.go index b4f7604..2dfbb2e 100644 --- a/pkg/storage/rabbitmq/rabbitmq.go +++ b/pkg/storage/rabbitmq/rabbitmq.go @@ -1,8 +1,7 @@ package rabbitmq import ( - "bytes" - "encoding/gob" + "fmt" "github.com/streadway/amqp" @@ -93,13 +92,6 @@ func (c storage) Name() string { // @param value that will be pushed // @return an error if the push failed func (c storage) Push(value interface{}) error { - var buf bytes.Buffer - - enc := gob.NewEncoder(&buf) - if err := enc.Encode(value); err != nil { - return err - } - if err := c.channel.Publish( c.config.Exchange, c.routingKey.Name, @@ -107,7 +99,7 @@ func (c storage) Push(value interface{}) error { c.config.Immediate, amqp.Publishing{ ContentType: c.config.ContentType(), - Body: []byte(buf.Bytes()), + Body: []byte(fmt.Sprintf("%v", value)), }); err != nil { return err } diff --git a/pkg/storage/rabbitmq/rabbitmq_test.go b/pkg/storage/rabbitmq/rabbitmq_test.go index f81db49..164237a 100644 --- a/pkg/storage/rabbitmq/rabbitmq_test.go +++ b/pkg/storage/rabbitmq/rabbitmq_test.go @@ -41,21 +41,7 @@ func (suite *RabbitMQSetupTestSuite) TestRabbitMQNewStorage() { } func (suite *RabbitMQSetupTestSuite) TestRabbitMQPush() { - newClient, _ := NewStorage(map[string]interface{}{ - "databaseUrl": "amqp://user:password@127.0.0.1:5672", - "queueName": "hello", - "contentType": "application/json", - "durable": false, - "deleteWhenUnused": false, - "exclusive": false, - "noWait": false, - "mandatory": false, - "immediate": false, - }) - err := newClient.Push(func() {}) - assert.Error(suite.T(), err) - - newClient, err = NewStorage(map[string]interface{}{ + newClient, err := NewStorage(map[string]interface{}{ "databaseUrl": "amqp://user:password@127.0.0.1:5672", "queueName": "hello", "contentType": "text/plain",