Skip to content

Commit

Permalink
feat: update data type for amqp client
Browse files Browse the repository at this point in the history
  • Loading branch information
restuhaqza committed Nov 23, 2021
1 parent 90ef55a commit 042e70f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions amqp/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Config struct {
Password string
}

type amqpClient struct {
type AmqpClient struct {
Connection *amqp.Connection
ServiceName string
}
Expand All @@ -27,18 +27,18 @@ func SetUri(config Config) string {
}

// Open Connection to AMQP Server
func NewClient(config Config) (*amqpClient, error) {
func NewClient(config Config) (*AmqpClient, error) {
uri := SetUri(config)
amqpConn, err := amqp.Dial(uri)

if err != nil {
return nil, err
}

return &amqpClient{Connection: amqpConn, ServiceName: config.ServiceName}, nil
return &AmqpClient{Connection: amqpConn, ServiceName: config.ServiceName}, nil
}

func (a *amqpClient) AddPublisher(publisher *publisher.PublisherConfig) {
func (a *AmqpClient) AddPublisher(publisher *publisher.PublisherConfig) {
channel, err := a.Connection.Channel()
if err != nil {
log.Println(err.Error())
Expand All @@ -62,7 +62,7 @@ func (a *amqpClient) AddPublisher(publisher *publisher.PublisherConfig) {
log.Println(fmt.Sprintf(`Exchange: %s created`, publisher.TopicName))
}

func (a *amqpClient) AddSubscriber(subscriber *subscriber.SubscriberConfig) {
func (a *AmqpClient) AddSubscriber(subscriber *subscriber.SubscriberConfig) {
channel, err := a.Connection.Channel()
if err != nil {
log.Println(err.Error())
Expand Down

0 comments on commit 042e70f

Please sign in to comment.