Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bxcodec committed Jun 9, 2024
1 parent b406b2d commit faa9393
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion consumer/rabbitmq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ func buildMessage(consumerMeta map[string]interface{}, receivedMsg amqp.Delivery
return msg, nil
}

func (r *rabbitMQ) requeueMessage(consumerMeta map[string]interface{}, receivedMsg amqp.Delivery) func(ctx context.Context, delayFn goqueue.DelayFn) (err error) {
func (r *rabbitMQ) requeueMessage(consumerMeta map[string]interface{},
receivedMsg amqp.Delivery) func(ctx context.Context, delayFn goqueue.DelayFn) (err error) {
return func(ctx context.Context, delayFn goqueue.DelayFn) (err error) {
if delayFn == nil {
delayFn = goqueue.DefaultDelayFn
Expand Down
9 changes: 8 additions & 1 deletion publisher/option.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package publisher

import "github.com/bxcodec/goqueue"
import (
"github.com/bxcodec/goqueue"
headerVal "github.com/bxcodec/goqueue/headers/value"
)

const (
DefaultContentType = headerVal.ContentTypeJSON
)

// Option define the option property
type Option struct {
Expand Down
4 changes: 3 additions & 1 deletion publisher/rabbitmq/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func New(
}

func (r *rabbitMQ) Publish(ctx context.Context, m goqueue.Message) (err error) {
if m.ContentType == "" {
m.ContentType = publisher.DefaultContentType
}
publishFunc := middleware.ApplyPublisherMiddleware(
r.buildPublisher(),
r.option.Middlewares...,
Expand Down Expand Up @@ -79,7 +82,6 @@ func (r *rabbitMQ) buildPublisher() goqueue.PublisherFunc {

m.Headers = headers
m.ServiceAgent = headerVal.RabbitMQ
m.ContentType = headerVal.ContentType(m.ContentType)
m.Timestamp = timestamp
m.ID = id
data, err := goqueue.GetGoquEncoding(m.ContentType).Encode(ctx, m)
Expand Down

0 comments on commit faa9393

Please sign in to comment.