Skip to content

Commit

Permalink
add method Disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
janiltonmaciel committed Aug 20, 2020
1 parent 0345f44 commit 20ed533
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions enqueuestomp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,13 @@ func (s *EnqueueStompSuite) TestSendTopicWithWriteDisk(c *check.C) {
enqueueCount := s.j.StatTopic(topicName, "EnqueueCount")
c.Assert(enqueueCount, check.Equals, strconv.Itoa(total))
}

func (s *EnqueueStompSuite) TestDisconnect(c *check.C) {
enqueue, err := enqueuestomp.NewEnqueueStomp(
enqueuestomp.Config{},
)
c.Assert(err, check.IsNil)

err = enqueue.Disconnect()
c.Assert(err, check.IsNil)
}
4 changes: 4 additions & 0 deletions enqueustomp.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func (emq *EnqueueStomp) Config() Config {
return emq.config
}

func (emq *EnqueueStomp) Disconnect() error {
return emq.conn.Disconnect()
}

func (emq *EnqueueStomp) send(destinationType string, destinationName string, body []byte, sc SendConfig) error {
if len(body) == 0 {
return ErrEmptyBody
Expand Down

0 comments on commit 20ed533

Please sign in to comment.