-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhub.go
39 lines (36 loc) · 965 Bytes
/
hub.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package queuemanager
import (
queuemanagerconfig "github.com/violetpay-org/queue-manager/config"
"github.com/violetpay-org/queue-manager/internal/queue/kafka"
"github.com/violetpay-org/queue-manager/internal/queue/redis"
queueitem "github.com/violetpay-org/queue-manager/item"
)
// NewRedisHub is a function that returns a new Hub.
func NewRedisHub(
messageSerializer queueitem.RedisSerializer,
config *queuemanagerconfig.RedisConfig,
logger func(string),
) *redis.Hub {
return redis.NewHub(
messageSerializer,
config,
logger,
)
}
// NewKafkaHub is a function that returns a new Hub.
// maxConsumerCount is the maximum number of consumers that can be created.
func NewKafkaHub(
maxConsumerCount int,
messageSerializer queueitem.KafkaSerializer,
publishOnly bool,
config *queuemanagerconfig.KafkaConfig,
logger func(string),
) *kafka.Hub {
return kafka.NewHub(
maxConsumerCount,
messageSerializer,
publishOnly,
config,
logger,
)
}