-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathservice.go
More file actions
25 lines (23 loc) · 900 Bytes
/
service.go
File metadata and controls
25 lines (23 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package consumer
import (
"github.com/bxcodec/goqueue/internal/consumer"
"github.com/bxcodec/goqueue/internal/consumer/rabbitmq"
"github.com/bxcodec/goqueue/options"
consumerOpts "github.com/bxcodec/goqueue/options/consumer"
)
// NewConsumer creates a new consumer based on the specified platform.
// It accepts a platform option and additional consumer option functions.
// It returns a consumer.Consumer interface implementation.
func NewConsumer(platform options.Platform, opts ...consumerOpts.ConsumerOptionFunc) consumer.Consumer {
switch platform {
case consumerOpts.ConsumerPlatformRabbitMQ:
return rabbitmq.NewConsumer(opts...)
case consumerOpts.ConsumerPlatformGooglePubSub:
// TODO (bxcodec): implement google pubsub publisher
case consumerOpts.ConsumerPlatformSQS:
// TODO (bxcodec): implement sns publisher
default:
panic("unknown publisher platform")
}
return nil
}